HTTP Accept Header

By: Dusty Arlia
Published on Friday, June 13, 2014, 07:49 PM
Last Updated on Saturday, July 11, 2015 at 12:30 PM
Total Updates: 2

The Accept HTTP header holds a value for acceptable HTTP response media types. An HTTP request without an Accept header field implies that the user agent will accept any media type. Accept header fields can be used to indicate that the response is limited to certain types (e.g. when requesting an image). Here is an example:

Accept: text/plain

Here is another example:

Accept: audio/*; q=0.2, audio/basic

This example is interpreted as "I prefer audio/basic, but send me any audio type if it is the best available after an 80% markdown in quality".

If the Accept header field is present in an HTTP request and none of the available representations for the HTTP response have a media type that is listed as acceptable, then the origin web server can either honor the Accept header field by sending a 406 (Not Acceptable) response or disregard the Accept header field by treating the HTTP response as if it is not subject to content negotiation.

Comments:

Ad:

Ad: