handle unexpected fetch Response and Request body types better

RESOLVED INVALID

Status

()

defect
RESOLVED INVALID
3 years ago
a month ago

People

(Reporter: bkelly, Unassigned)

Tracking

48 Branch
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

When an invalid type is passed as the body of a Response or Request, we currently end up calling toString() on it or something.

Type this into web console:

  var r = new Response({ foo:'bar' });
  r.text().then(t => console.log(t)).catch(e => console.log(e))

The resulting output will be:

  [object Object]

The spec currently suggests we should ignore bodies with unexpected types:

  https://fetch.spec.whatwg.org/#concept-bodyinit-extract

This spec issue suggests we should throw instead:

https://github.com/whatwg/fetch/issues/371

But we currently do the wrong thing
Turns out our behavior is correct.  The object is coerced to a USVString at the webidl interface layer.  Nothing to see here...
No longer blocks: ServiceWorkers-compat
Status: NEW → RESOLVED
Last Resolved: 3 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
Product: Core → Core
You need to log in before you can comment on or make changes to this bug.