Skip to content

fix(response): validate Response init status and null-body statuses#1874

Open
nthbotast wants to merge 1 commit intonode-fetch:mainfrom
nthbotast:fix-response-init-status-validation
Open

fix(response): validate Response init status and null-body statuses#1874
nthbotast wants to merge 1 commit intonode-fetch:mainfrom
nthbotast:fix-response-init-status-validation

Conversation

@nthbotast
Copy link
Copy Markdown

Summary

  • enforce Response init status range to [200, 599] per Fetch spec
  • throw when a body is provided with null-body statuses (101, 103, 204, 205, 304)
  • keep Response.error() behavior by setting internal status to 0 after construction
  • add focused tests for invalid statuses and null-body status/body combinations

Testing

  • npm test -- test/response.js

Fixes #1685

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

When initializing a response it should throw if status is not in the range 200 to 599

1 participant