Re: [whatwg/fetch] Fetch would silently ignore the input body if it's not an existing data type? (#371)

I think Firefox's behavior is correct. Objects can be converted to USVStrings; this happens automatically in IDL.

In general everywhere on the platform that accepts a string will just convert your object to a string instead of throwing. E.g.

```js
document.body.setAttribute("a", { foo: "bar" });
console.assert(document.body.getAttribute("a") === "[object Object]");

document.body.setAttribute("b", { toString() { return "this is intentional"; } });
console.assert(document.body.getAttribute("b") === "this is intentional");
```

I don't think Request/Response should be any different.

What you really want here is a strongly typed language, like TypeScript.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/issues/371#issuecomment-241063649

Received on Friday, 19 August 2016 16:19:48 UTC