diff --git a/fetch.bs b/fetch.bs index 17e833703..5153ce150 100644 --- a/fetch.bs +++ b/fetch.bs @@ -15,7 +15,7 @@ Markup Shorthands: css off !Commits: [SNAPSHOT-LINK] !Commits: @fetchstandard !Translation (non-normative): 日本語 -Translate IDs: typedefdef-bodyinit bodyinit,typedefdef-responsebodyinit responsebodyinit,dictdef-requestinit requestinit,typedefdef-requestinfo requestinfo,enumdef-requesttype requesttype,enumdef-requestdestination requestdestination,enumdef-requestmode requestmode,enumdef-requestcredentials requestcredentials,enumdef-requestcache requestcache,enumdef-requestredirect requestredirect,dictdef-responseinit responseinit,enumdef-responsetype responsetype +Translate IDs: typedefdef-bodyinit bodyinit,dictdef-requestinit requestinit,typedefdef-requestinfo requestinfo,enumdef-requesttype requesttype,enumdef-requestdestination requestdestination,enumdef-requestmode requestmode,enumdef-requestcredentials requestcredentials,enumdef-requestcache requestcache,enumdef-requestredirect requestredirect,dictdef-responseinit responseinit,enumdef-responsetype responsetype @@ -571,13 +571,16 @@ user-agent-defined value for the
A body consists of:
A stream (a {{ReadableStream}} object). +
A stream (null or a {{ReadableStream}} + object).
A transmitted bytes (an integer), initially 0.
A total bytes (an integer), initially 0. + +
A source, initially null.
A body body is said to be @@ -2984,6 +2987,10 @@ in addition to HTTP fetch above. includes credentials, then return a network error. +
If actualResponse's status is not 303
,
+ request's body is non-null, and request's
+ body's source is null, then return a network error.
+
If CORS flag is set and actualResponse's
location URL
@@ -3008,6 +3015,15 @@ in addition to HTTP fetch above.
to `GET
` and request's body
to null.
+
If request's body is non-null, then set request's + body to the first part of extracting + request's body's source. + +
request's body's source's + nullity has already been checked. The extracting operation cannot + throw as it was called for the same source before. +
Append actualResponse's location URL to request's url list. @@ -3035,17 +3051,31 @@ steps: authentication-fetch flag.
Let httpRequest be null. + +
If request's window is "no-window
" and
+ request's redirect mode is "error
", then set
+ httpRequest to request.
+
Let httpRequest be request if
- request's window is "no-window
"
- and request's redirect mode is
- "error
", and the result of cloning
- request otherwise.
+
Otherwise, run these substeps: -
A request is typically cloned as it needs to be possible to - add headers and read its - body without affecting request. As - request is reused with redirects, authentication, and proxy authentication. +
Set httpRequest to a copy of request except for its + body. + +
Let body be request's body. + +
Set httpRequest's body to body. + +
If body is non-null, then set request's body to a + new body whose stream is null and whose source is + body's source. +
Here we do not clone request in order + to reduce memory consumption. request can be reused with redirects, authentication, + and proxy authentication.
Let credentials flag be set if one of @@ -3326,6 +3356,22 @@ steps:
Needs testing: multiple `WWW-Authenticate
` headers, missing,
parsing issues.
+
If request's body is non-null, then run these subsubsteps: + +
If request's body's source is null, + then return a network error. + +
Set request's body to the first part of + extracting request's body's + source. + +
The extracting operation cannot + throw as it was called for the same source before. +
If request's use-URL-credentials flag is unset or @@ -4184,9 +4230,7 @@ method, when invoked, must run these steps:
-typedef (Blob or BufferSource or FormData or URLSearchParams or USVString) BodyInit; - -typedef (BodyInit or ReadableStream) ResponseBodyInit;+typedef (Blob or BufferSource or FormData or URLSearchParams or ReadableStream or USVString) BodyInit;
To extract a body and a
`Content-Type
` value from
@@ -4199,7 +4243,9 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
Let Content-Type be null. -
Let action be null. +
Let action be null. + +
Let source be null.
Switch on object's type: @@ -4212,6 +4258,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
If object's {{Blob/type}} attribute is not the empty byte sequence, set Content-Type to its value. +
Set source to object. +
BufferSource
Enqueue a Uint8Array
object
@@ -4220,6 +4268,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
stream. If that threw an exception,
error stream with that exception.
+
Set source to object. +
Set action to an action that runs the
@@ -4232,6 +4282,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
multipart/form-data
boundary string generated by the
multipart/form-data
encoding algorithm.
+
Set source to object. +
Set action to an action that runs the @@ -4243,12 +4295,16 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit;
Set Content-Type to
`application/x-www-form-urlencoded;charset=UTF-8
`.
+
Set source to object. +
USVString
Set action to an action that runs UTF-8 encode on object.
Set Content-Type to `text/plain;charset=UTF-8
`.
+
Set source to object. +
Set stream to object. @@ -4272,8 +4328,8 @@ typedef (BodyInit or ReadableStream) ResponseBodyInit; close stream.
Let body be a body whose stream is + stream and whose source is source.
Return body and Content-Type. @@ -4914,7 +4970,7 @@ run these steps:
[Constructor(optional ResponseBodyInit? body = null, optional ResponseInit init), +[Constructor(optional BodyInit? body = null, optional ResponseInit init), Exposed=(Window,Worker)] interface Response { [NewObject] static Response error();