diff --git a/files/en-us/_redirects.txt b/files/en-us/_redirects.txt index 4547555c56d82de..57eaaf93be3fe44 100644 --- a/files/en-us/_redirects.txt +++ b/files/en-us/_redirects.txt @@ -3585,6 +3585,7 @@ /en-US/docs/Glossary/GZip /en-US/docs/Glossary/gzip_compression /en-US/docs/Glossary/Global_attribute /en-US/docs/Web/HTML/Global_attributes /en-US/docs/Glossary/Grid_Rows /en-US/docs/Glossary/Grid_Row +/en-US/docs/Glossary/Guard /en-US/docs/Web/API/Fetch_API/Using_Fetch /en-US/docs/Glossary/Hash_function /en-US/docs/Glossary/Cryptographic_hash_function /en-US/docs/Glossary/Header /en-US/docs/Glossary/HTTP_header /en-US/docs/Glossary/I18N /en-US/docs/Glossary/Internationalization @@ -8171,6 +8172,7 @@ /en-US/docs/Web/API/FetchSignal /en-US/docs/Web/API/AbortSignal /en-US/docs/Web/API/FetchSignal/aborted /en-US/docs/Web/API/AbortSignal/aborted /en-US/docs/Web/API/FetchSignal/onabort /en-US/docs/Web/API/AbortSignal/abort_event +/en-US/docs/Web/API/Fetch_API/Basic_concepts /en-US/docs/Web/API/Fetch_API/Using_Fetch /en-US/docs/Web/API/File.lastModifiedDate /en-US/docs/Web/API/File/lastModifiedDate /en-US/docs/Web/API/File.name /en-US/docs/Web/API/File/name /en-US/docs/Web/API/File.size /en-US/docs/Web/API/Blob/size diff --git a/files/en-us/_wikihistory.json b/files/en-us/_wikihistory.json index 080fcc06e0d1e4b..09e142d26bbe6e5 100644 --- a/files/en-us/_wikihistory.json +++ b/files/en-us/_wikihistory.json @@ -2625,10 +2625,6 @@ "modified": "2020-03-26T14:30:59.270Z", "contributors": ["mfuji09", "j9t", "teoli", "rachelandrew"] }, - "Glossary/Guard": { - "modified": "2019-01-16T20:19:28.335Z", - "contributors": ["chrisdavidmills", "klez", "Andrew_Pfeiffer", "kscarfone"] - }, "Glossary/Gutters": { "modified": "2019-03-23T22:16:42.903Z", "contributors": ["Verger", "teoli", "rachelandrew"] @@ -34999,21 +34995,6 @@ "kscarfone" ] }, - "Web/API/Fetch_API/Basic_concepts": { - "modified": "2020-02-18T19:55:22.051Z", - "contributors": [ - "jswisher", - "Sheppy", - "sideshowbarker", - "LurN", - "parambirs", - "chrisdavidmills", - "gapple", - "lawrencekgrant", - "gbharatwaj", - "smarvin" - ] - }, "Web/API/Fetch_API/Cross-global_fetch_usage": { "modified": "2020-10-06T03:40:09.140Z", "contributors": ["ralflang", "mfluehr", "piotrekwitek", "chrisdavidmills"] diff --git a/files/en-us/glossary/guard/index.md b/files/en-us/glossary/guard/index.md deleted file mode 100644 index 6d9d5f38d4bfb35..000000000000000 --- a/files/en-us/glossary/guard/index.md +++ /dev/null @@ -1,9 +0,0 @@ ---- -title: Guard -slug: Glossary/Guard -page-type: glossary-definition ---- - -{{GlossarySidebar}} - -Guard is a feature of {{domxref("Headers")}} objects (as defined in the {{domxref("Fetch_API","Fetch spec")}}, which affects whether methods such as {{domxref("Headers.set","set()")}} and {{domxref("Headers.append","append()")}} can change the header's contents. For example, `immutable` guard means that headers can't be changed. For more information, read [Fetch basic concepts: guard](/en-US/docs/Web/API/Fetch_API/Basic_concepts#guard). diff --git a/files/en-us/web/api/fetch_api/basic_concepts/index.md b/files/en-us/web/api/fetch_api/basic_concepts/index.md deleted file mode 100644 index 43d7f4782edf05b..000000000000000 --- a/files/en-us/web/api/fetch_api/basic_concepts/index.md +++ /dev/null @@ -1,69 +0,0 @@ ---- -title: Fetch basic concepts -slug: Web/API/Fetch_API/Basic_concepts -page-type: guide ---- - -{{DefaultAPISidebar("Fetch API")}} - -The [Fetch API](/en-US/docs/Web/API/Fetch_API) provides an interface for fetching resources (including across the network). It will seem familiar to anyone who has used {{domxref("XMLHttpRequest")}}, but it provides a more powerful and flexible feature set. This article explains some of the basic concepts of the Fetch API. - -> **Note:** This article will be added to over time. If you find a Fetch concept that you feel needs explaining better, let someone know on the [MDN Web Docs chat rooms](/en-US/docs/MDN/Community/Communication_channels#chat_rooms). - -## In a nutshell - -At the heart of Fetch are the Interface abstractions of HTTP {{domxref("Request")}}s, {{domxref("Response")}}s, and {{domxref("Headers")}}, along with a {{domxref("fetch()")}} method for initiating asynchronous resource requests. Because the main components of HTTP are abstracted as JavaScript objects, it is easy for other APIs to make use of such functionality. - -[Service Workers](/en-US/docs/Web/API/Service_Worker_API) is an example of an API that makes heavy use of Fetch. - -Fetch takes the asynchronous nature of such requests one step further. The API is completely {{jsxref("Promise")}}-based. - -## Guard - -Guard is a feature of {{domxref("Headers")}} objects, with possible values of `immutable`, `request`, `request-no-cors`, `response`, or `none`, depending on where the header is used. - -When a new {{domxref("Headers")}} object is created using the {{domxref("Headers.Headers","Headers()")}} {{glossary("constructor")}}, its guard is set to `none` (the default). When a {{domxref("Request")}} or {{domxref("Response")}} object is created, it has an associated {{domxref("Headers")}} object whose guard is set as summarized below: - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
new object's typecreating constructor - guard setting of associated {{domxref("Headers")}} object -
{{domxref("Request")}}{{domxref("Request.Request","Request()")}}request
- {{domxref("Request.Request","Request()")}} with - {{domxref("Request.mode","mode")}} of no-cors - request-no-cors
{{domxref("Response")}}{{domxref("Response.Response","Response()")}}response
- {{domxref("Response.error_static", "Response.error()")}} or - {{domxref("Response.redirect_static", "Response.redirect()")}} methods - immutable
- -A header's guard affects the {{domxref("Headers.set","set()")}}, {{domxref("Headers.delete","delete()")}}, and {{domxref("Headers.append","append()")}} methods which change the header's contents. A {{jsxref("TypeError")}} is thrown if you try to modify a {{domxref("Headers")}} object whose guard is `immutable`. However, the operation will work if - -- guard is `request` and the header _name_ isn't a {{Glossary("forbidden header name")}} . -- guard is `request-no-cors` and the header _name_/_value_ is a {{Glossary("CORS-safelisted request header", "simple header")}} . -- guard is `response` and the header _name_ isn't a {{Glossary("forbidden response header name")}} . diff --git a/files/en-us/web/api/fetch_api/index.md b/files/en-us/web/api/fetch_api/index.md index bb50f0b790cf2b7..075b8b76b8ef35e 100644 --- a/files/en-us/web/api/fetch_api/index.md +++ b/files/en-us/web/api/fetch_api/index.md @@ -21,7 +21,7 @@ Once a {{DOMxRef("Response")}} is retrieved, there are a number of methods avail You can create a request and response directly using the {{DOMxRef("Request.Request", "Request()")}} and {{DOMxRef("Response.Response", "Response()")}} constructors, but it's uncommon to do this directly. Instead, these are more likely to be created as results of other API actions (for example, {{DOMxRef("FetchEvent.respondWith()")}} from service workers). -Find out more about using the Fetch API features in [Using Fetch](/en-US/docs/Web/API/Fetch_API/Using_Fetch), and study concepts in [Fetch basic concepts](/en-US/docs/Web/API/Fetch_API/Basic_concepts). +Find out more about using the Fetch API features in [Using Fetch](/en-US/docs/Web/API/Fetch_API/Using_Fetch). ## Fetch Interfaces diff --git a/files/jsondata/GroupData.json b/files/jsondata/GroupData.json index 71c44644fc6719e..4053acb01410200 100644 --- a/files/jsondata/GroupData.json +++ b/files/jsondata/GroupData.json @@ -519,7 +519,6 @@ "overview": ["Fetch API"], "guides": [ "/docs/Web/API/Fetch_API/Using_Fetch", - "/docs/Web/API/Fetch_API/Basic_concepts", "/docs/Web/API/Fetch_API/Cross-global_fetch_usage" ], "interfaces": ["Headers", "Request", "Response"],