Headers object
Customizing request headers is important when crafting unique requests and responses between the client and server. The request headers property is a Headers object. Header objects are used by both request and response objects.
Headers are a way for the client and server to communicate extra information about the request and response. Think about them as meta data about the data being sent back and forth.
For example, when a response includes gzip compressed data, the Content-Encoding header tells the browser so it can decompress the body. Before returning a compressed response, the server looks for a corresponding header, such as accept-encoding, telling it that the client can accept a compressed response.
The Headers object ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access