Table of Contents

HTTP - Accept header

About

accept is a request header that specify the mimes type of the response body that are accepted by the client (ie browser)

Syntax

Without

If no Accept header field is present, then it is assumed that the client accepts all media types.

With

In abnf

Accept         = "Accept" ":" *( media-range [ accept-params ] )
media-range    = ( "*/*"  | ( type "/" "*" ) | ( type "/" subtype ) ) *( ";" parameter )
accept-params  = ";" "q" "=" qvalue *( accept-extension )
accept-extension = ";" token [ "=" ( token | quoted-string ) ]

where:

Response

The response would define the mime type of the body with the content-type header.

If no media of the requested type can be send, the response status should be a 406 - Not acceptable

Example

Accept: audio/*; q=0.2, audio/basic
Accept: text/plain, text/html
Accept: text/plain; q=0.9, text/html
Accept: text/css,*/*;q=0.1
Accept: */*
Accept: image/avif,image/webp,image/apng,image/svg+xml,image/*,*/*;q=0.8

Documentation / Reference