← Rule catalog

Source kernel · Reliability

HTTP body read without checking the status

rust_doctor::source::unchecked_http_status

Call .error_for_status()? before reading the body, or match on .status() and handle the error payload.

Category
Reliability
Default level
warn
Tier
P2
Producer
Source kernel
Diff scope
item

Not a defect when

The status is checked elsewhere before the body is trusted, for example by middleware or by a helper the response is passed through, or the error body is deliberately parsed as data.

Crates it waits for

It runs only where at least one of these crates is resolved, and every one resolved sits in the range it was validated on:

  • reqwest *

What it reads

Source text, without resolving types or expanding macros.

Tier

Ordinary defect.

The tier bounds how severe a rule may be; its category bounds the tier.

Diff scope

The function or item around the changed line.

What --scope contextual looks at to decide whether a change caused the finding.

Change it

Turn it off, or make it blocking, without touching the code it flags:

rust-doctor --rule rust_doctor::source::unchecked_http_status=off .
rust-doctor --rule rust_doctor::source::unchecked_http_status=error .

Set it once in rust-doctor.toml

Other Reliability rules