Closed Bug 1296626 Opened 8 years ago Closed 8 years ago

handle unexpected fetch Response and Request body types better

Categories

(Core :: DOM: Core & HTML, defect)

48 Branch
defect
Not set
normal

Tracking

()

RESOLVED INVALID

People

(Reporter: bkelly, Unassigned)

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
Closed: 8 years ago
Resolution: --- → INVALID
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.