Re: [whatwg/fetch] Editorial: Add prose about constructing a request (PR #1585)

@noamr commented on this pull request.



> @@ -8385,6 +8388,69 @@ correctly. This section aims to give some advice.
 
 <p class=XXX>This is a work in progress.
 
+<h3 id=fetch-elsewhere-request>Populating a request</h3>
+
+<p>The first step in <a for=/>fetching</a> is to create a <a for=/>request</a>, and populate its
+multiple associated parameters.
+
+<p>Start by setting the <a for=/>request</a>'s <a for=request>URL</a> and <a for=request>method</a>,
+as defined by HTTP. If your `<code>POST</code>` or `<code>PUT</code>` <a for=/>request</a> needs a
+body, you can assign or stream it to <a for=/>request</a>'s <a for=request>body</a>. [[HTTP]]
+
+<p>Set your <a for=/>request</a>'s <a for=request>client</a> to the
+<a>environment settings object</a> you're operating in. Web-exposed APIs usually operate on
+<a>platform objects</a> (e.g. a <cite>Web IDL</cite> based API), which have a
+<a>relevant settings object</a>. For example, a <a for=/>request</a> associated with a DOM
+<a for=/>element</a> would set the <a for=/>request</a>'s <a for=request>client</a> to the element's
+<a>node document</a>'s <a>relevant settings object</a>. [[WEBIDL]]

> I believe these are all web-exposed:
> 
> * https://wicg.github.io/attribution-reporting-api/#create-a-report-request

Seems like the fetch itself is not web exposed?

> 
> * https://wicg.github.io/background-fetch/#background-fetch-manager-fetch

This is a JS API with an IDL interface, which has a relevant settings object.

> 
> * https://w3c.github.io/reporting/#try-delivery

Seems like this ends up also doing something with a JS observer, which has a relevant settings object


-- 
Reply to this email directly or view it on GitHub:
https://github.com/whatwg/fetch/pull/1585#discussion_r1062725986
You are receiving this because you are subscribed to this thread.

Message ID: <whatwg/fetch/pull/1585/review/1237780628@github.com>

Received on Thursday, 5 January 2023 17:38:09 UTC