Skip to content

HTTP fetch treats only status 200 as success #11

Description

@AlexAxthelm

Severity: minor (correctness; rare in practice)

Where
shared/src/app.rs, Event::FeedFetched handling:
HttpResult::Response { status: 200, body } => …
with a catch-all HttpResult::Response { status, .. } that sets
"feed fetch failed: HTTP {status}".

Problem
Any 2xx other than 200 (203 Non-Authoritative, 206, 226, …) carries a valid body
but falls through to the error arm and is reported as a failure. Redirects are not
a concern (URLSession follows 3xx itself), so the realistic cases are uncommon —
but the success condition should be a range, not an equality.

Suggested fix
Match status @ 200..=299 for the success arm; keep the catch-all for everything
else. Add a test for a 2xx≠200 response with a parseable body.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions