Htttp Header:- Http Header is a field of an HTTP request or response that passes additional info about the request or response. For example, a request message can use headers to indicate it's preferred media formats, while a response can use header to indicate the media format of the returned body.
- Accept
- Accept-Encoding
- Authorization
- Origin
- Referer
- User-Agent
- If-Modified Since
- If-None-Match
- Cookie
- Host
- Pragma
- Server
- Set-Cookie
- www-Authentication:- Basic,Bearer Token,Digest etc
- x-Frame-options
- Cache-Control
- Location
- Expire
Representation Header:- metadata about the resource in the message body (e.g. encoding, media type, etc.).
- Content-Type
- Content-Encoding
- Content-Length
- Connection
- Transfer-Encoding
- Sec-Fetch-Site
- Sec-Fetch-Mode
- Sec-Fetch-User
- Sec-Fetch-Dest
Note:-The current HTTP/1.1 specification no longer refers to entities, entity headers or entity-body. Some of the fields are now referred to as Representation header fields.
The Accept header attribute specifies the format of response data which the client expects.
GET /posts HTTP/1.1
Accept:application/json
GET /posts/42 HTTP/1.1
Accept: application/xml
Content-Type header attribute specifies the format of the data in the request body so that receiver can parse it into appropriate format.
ContentType: application/x-www-form-urlencoded
ContentType: application/multipart/form-data