The HTTP Accept header is a request type header. The Accept header is used to inform the server by the client that which content type is understandable by the client expressed as MIME-types. By using the Content-negotiation the server selects a proposal of the content type and informs the client of its choice with the Content-type response header. If the Accept header is not present in the request, then the server assumes that the client accepts all types of media.
Accept: <MIME_type>/<MIME_subtype> | <MIME_type>/* | */*
Directives: This header accept below mentioned directives:
- <MIME_type>/<MIME_subtype>: This directive holds the type/subtype of the web content that the client will received by content-type header which is chosen by the server from Accept header. Basically it holds the single mime type like text/html.
- <MIME_type>/*: This directive holds the type but can accept any subtyping like image/* means the image can be jpg, png, or can svg everything will be accepted.
- */* This directive accepts any kind of type/subtype.
- This example accepts the text type with the subtype of html.
- This example accept any image subtype does not bother.
To check this Accept in action go to Inspect Element -> Network check the request header for Accept like below, Accept is highlighted you can see.
Supported Browsers: The browsers are compatible with HTTP Accept header are listed below:
- Google Chrome
- Internet Explorer
- HTTP headers | Accept-CH
- HTTP headers | Accept-Patch
- HTTP headers | Accept-Language
- HTTP headers | Sec-WebSocket-Accept
- HTTP headers | Accept-Charset
- HTTP headers | Accept-Ranges
- HTTP headers | Accept-Encoding
- HTTP headers | Access-Control-Expose-Headers
- HTTP headers | Access-Control-Allow-Headers.
- HTTP Headers | TE
- HTTP headers | Via
- HTTP headers | Age
- HTTP headers | Allow
- HTTP headers
- HTTP headers | If-None-Match
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.