@@ -7879,6 +7879,63 @@ resource — for non-<a>CORS requests</a> as well as <a>CORS
7879
7879
requests</a> — and do not use `<code> Vary</code> `.
7880
7880
7881
7881
7882
+ <h2 id=fetch-elsewhere class=no-num>Using fetch in other standards</h2>
7883
+
7884
+ <p> In its essence <a for=/>fetching</a> is an exchange of a <a for=/>request</a> for a
7885
+ <a for=/>response</a> . In reality it is rather complex mechanism for standards to adopt and use
7886
+ correctly. This section aims to give some advice.
7887
+
7888
+ <p class=warning> Always ask domain experts for review.
7889
+
7890
+ <p class=XXX> This is a work in progress.
7891
+
7892
+
7893
+ <h3 id=fetch-elsewhere-fetch class=no-num>Invoking fetch</h3>
7894
+
7895
+ <p> Aside from a <a for=/>request</a> the <a for=/>fetch</a> operation takes several optional
7896
+ arguments. For those arguments that take an algorithm: the algorithm will be called from a task (or
7897
+ in a <a for=/>parallel queue</a> if <a for=fetch><i>useParallelQueue</i></a> is true).
7898
+
7899
+ <dl>
7900
+ <dt> <a for=fetch><i>processRequestBody</i></a>
7901
+ <dd><p> Takes an algorithm that will be passed the number of bytes that have been transmitted from
7902
+ the <a for=/>request</a> 's <a for=request>body</a> . The algorithm will be invoked for each
7903
+ transmitted chunk. Most standards will not need this.
7904
+
7905
+ <dt> <a for=fetch><i>processRequestEndOfBody</i></a>
7906
+ <dd><p> Takes an algorithm that will be passed nothing. Indicates <a for=/>request</a> 's
7907
+ <a for=request>body</a> has been transmitted. Most standards will not need this.
7908
+
7909
+ <dt> <a for=fetch><i>processResponse</i></a>
7910
+ <dd><p> Takes an algorithm that will be passed a <a for=/>response</a> . Indicates
7911
+ <a for=/>response</a> 's <a for=response>header list</a> has been received and initialized. This
7912
+ is primarily useful for standards that want to operate on <a for=/>response</a> 's
7913
+ <a for=response>body</a> 's <a for=body>stream</a> directly.
7914
+
7915
+ <dt> <a for=fetch><i>processResponseEndOfBody</i></a>
7916
+ <dd>
7917
+ <p> Takes an algorithm that will be passed a <a for=/>response</a> and null, failure, or a
7918
+ <a>byte sequence</a> . This is useful for standards that wish to operate on the entire
7919
+ <a for=/>response</a> 's <a for=response>body</a> , of which the result of reading it is supplied as
7920
+ second argument.
7921
+
7922
+ <p> It might be surprising that a <a for=/>network error</a> will have null as second argument.
7923
+
7924
+ <p class=warning> A standard that uses this argument cannot operate on <a for=/>response</a> 's
7925
+ <a for=response>body</a> itself as providing this argument will cause it to be read and it can be
7926
+ read only once.
7927
+
7928
+ <dt> <a for=fetch><i>processResponseDone</i></a>
7929
+ <dd><p> Takes an algorithm that will be passed a <a for=/>response</a> . Indicates the network is
7930
+ done transmitting the response. This does not read <a for=/>response</a> 's
7931
+ <a for=response>body</a> .
7932
+
7933
+ <dt> <a for=fetch><i>useParallelQueue</i></a>
7934
+ <dd><p> Takes a <a for=/>boolean</a> that defaults to false. Indicates where the algorithms passed
7935
+ as arguments will be invoked. Hopefully most standards will not need this.
7936
+ </dl>
7937
+
7938
+
7882
7939
<h2 id=acknowledgments class=no-num>Acknowledgments</h2>
7883
7940
7884
7941
<p> Thanks to
0 commit comments