Client and server can pass the extra bit of information with the request and response using HTTP headers.
HTTP headers are not case-sensitive.
The HTTP headers are divided into four categories:
1οΈβ£ Request headers: Client to Server
2οΈβ£ Response headers: Server to Client
3οΈβ£ Representation headers: Information about the body of the resource
4οΈβ£ Payload headers: Information about the payload data
π Accept
`Accept` header is used when the client wants to inform the server about the type of data that the client can understand.
For example,
Accept: image/png
π Accept-Encoding
The `Accept-Encoding` header is usually attached with a request to the server, indicating which encoding method is understandable by the client.
For example,
Accept-Encoding: gzip
π Authorization
As the header name suggests, the `Authorization` request header is used to pass the credentials so that the server can authenticate the client.
For example,
Authorization: Basic dgfhWUytzgdfhgSYG
π Accept-Language
The `Accept-Language` request header is used to describe which language is understood by the client.
For example,
Accept-Language: en-US
π Content-Type
`Content-Type` representational header specifies the media type of the resource. This header indicates the content type of the returned data when the client didn't mention any content encoding.
For example,
Content-Type: text/html; charset=UTF-8
π Content-Location
`Content-Location` header indicates the alternate location for the response. It is used when an API can return data in different formats depending on the `Accept` header.
The `Content-Encoding` header is used to compress the message data or payload.
For example,
Content-Encoding: gzip
π Content-Length
As the header name suggests, it indicates the size of the resource or message body in bytes. It can be used with both request and response.
For example,
Content-Length: 148
π Content-Language
`Content-Language` indicates the human logical language of the response. This header is used to deliver resources in multiple languages so that users can choose their preferred language.
For example,
Content-Language: en-US
π Cache-Control
`Cache-Control` header is used as a caching mechanism for both the request and response.
There are several directives(values) that we can pass with this header.
For example,
Cache-Control: max-age
With that being said, this is the end of this thread.
Follow @Rapid_API for more excellent content. ππ
Peace out!
β’ β’ β’
Missing some Tweet in this thread? You can try to
force a refresh