[whatwg/fetch] Why doesn't the "body" member of RequestInit have a default value? (#933)

The member is defined at https://fetch.spec.whatwg.org/#dom-requestinit-body as follows:
```
  BodyInit? body;
```
The only consumer of the `RequestInit` dictionary is https://fetch.spec.whatwg.org/#dom-request which does this:

> If either init["body"] exists and is non-null or inputBody is non-null, and request’s method is `GET` or `HEAD`, then throw a TypeError.

and

> If init["body"] exists and is non-null, then: 

In both cases, "does not exist" and "exists but is null" are treated identically, so it seems like the IDL could just say:
```
BodyInit? body = null;
```
and not worry about the "does not exist" case.

-- 
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/933

Received on Tuesday, 10 September 2019 06:06:08 UTC