Mastering Fetch Requests: A Comprehensive Guide to Customization
syndu | Oct. 18, 2023, 1:43 p.m.
Harmonize the properties of ExternalResource to fully match all the arguements of the fetch request
To fully customize a fetch request, you would need to consider the following parameters:
- URL: This is the most important parameter. It is the address of the resource on the web you want to fetch.
- Method: This is the HTTP method you want to use for your request. It could be GET, POST, PUT, DELETE, etc.
- Headers: This is an object representing any HTTP headers you want to include in your request. It could include content type, authorization, etc.
- Body: This is the data you want to send with your request. It is used with methods like POST or PUT.
- Mode: This is the mode you want to use for the request. It could be cors, no-cors, same-origin, or navigate.
- Credentials: This is the request credentials you want to use for the request. It could be include, same-origin, or omit.
- Cache: This is the cache mode you want to use for the request. It could be default, no-store, reload, no-cache, force-cache, or only-if-cached.
- Redirect: This is the redirect mode to use. It could be follow, error, or manual.
- Referrer: This is the referrer of the request. It could be a URL or a string like no-referrer, client, or a URL.
- ReferrerPolicy: This is the referrer policy to use for the request. It could be no-referrer, no-referrer-when-downgrade, origin, origin-when-cross-origin, unsafe-url, etc.
- Integrity: This is the subresource integrity value of the request. It is a hash of the resource you're fetching that ensures the resource hasn't been tampered with.
- Keepalive: This is a boolean that indicates whether or not the browser should keep the connection alive.
By manipulating these parameters, you can fully customize your fetch request to suit your specific needs.
Harmonize the properties of ExternalResource to fully match all the arguments of the fetch request, as well as the control parameters required to run the fetch logic.
The app you are using right now is Lilith's Grimoire
The Grimoire is full of Source Code. It is alive, and running, and you can explore the way it is built
The first lesson uncovers all of it.