[whatwg/fetch] It is hard read this section because of 4 "body"s and reassigning each other. (#954)

https://fetch.spec.whatwg.org/commit-snapshots/ae6435fdfd08f10833bbe65bd0ba559192baa330/#request-class


> Let inputBody be input’s request’s body if input is a Request object, and null otherwise\.
> 
> 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\.
> 
> Let body be inputBody\.
> 
> If init\["body"\] exists and is non\-null, then:​
> 
> Let Content\-Type be null\.
> 
> If init\["keepalive"\] exists and is true, then set body and Content\-Type to the result of extracting init\["body"\], with the keepalive flag set\.
> 
> Otherwise, set body and Content\-Type to the result of extracting init\["body"\]\.
> 
> If Content\-Type is non\-null and r’s headers’s header list does not contain \`Content\-Type\`, then append \`Content\-Type\`/Content\-Type to r’s headers\.
> 
> If body is non\-null and body’s source is null, then:​
> 
> If r’s request’s mode is neither "same\-origin" nor "cors", then throw a TypeError\.
> 
> Set r’s request’s use\-CORS\-preflight flag\.
> 
> If inputBody is body and input is disturbed or locked, then throw a TypeError\.
> 
> If inputBody is body and inputBody i\.\.\.

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

Received on Tuesday, 29 October 2019 04:15:55 UTC