What properties can be set in the object passed in the fetch() call?

Question

In the context of this exercise, we passed an object as the second argument of the fetch() call. What other properties can we set for this object?

Answer

You can set multiple custom settings of the request by setting properties of the object passed in the fetch() call. Some of these properties are as follows:

method - This specifies the request method such as GET or POST.

headers - This sets any headers to include with the request.

body - This is the body to add to the request, such as Blob or BufferSource.

mode - This property sets the mode used for the request, which includes cors, no-cors, or same-origin.

credentials - The request credentials used for this request, which includes omit, same-origin, or include.

cache - This property sets the cache mode used for the request.