Name

Accept

Synopsis

The Accept header is used by clients to let servers know what media types are acceptable. The value of the Accept header field is a list of media types that the client can use. For instance, your web browser cannot display every type of multimedia object on the Web. By including an Accept header in your requests, your browser can save you from downloading a video or other type of object that you can’t use.

The Accept header field also may include a list of quality values (q values) that tell the server which media type is preferred, in case the server has multiple versions of the media type. See Chapter 17 for a complete discussion of content negotiation and q values.

Type

Request header

Notes

“*” is a special value that is used to wildcard media types. For example, “*/*” represents all types, and “image/*” represents all image types.

Examples

Accept: text/*, image/*

Accept: text/*, image/gif, image/jpeg;q=1

Get HTTP: The Definitive Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.