Skip to content

http: more strict statusCode validation

Rodrigo Muino Tomonari requested to merge github/fork/nfriedly/issue-9027 into master
Checklist
  • make -j8 test (UNIX), or vcbuild test nosign (Windows) passes
  • tests and/or benchmarks are included
  • commit message follows commit guidelines
Affected core subsystem(s)

HTTP

Description of change

This removes the http statusCode coercion, and instead performs more strict validation on the original value, either using it unchanged or throwing.

Of note, some values that were previously accepted no longer are:

  • Any otherwise-valid string: '200' previously was accepted, it throws a TypeError with this change
  • Numbers with decimals: 200.6 was previously accepted (and silently coerced to 200), it throws a RangeError with this change.

All non-number values will now get a TypeError instead of a RangeError.

Fixes #9027 (closed)

Merge request reports

Loading