Aller au contenu principal

4. Example (exemple)

Un client envoie une requête POST en utilisant le Content Coding "compress" ([RFC7231], section 3.1.2.1) :

POST /edit/ HTTP/1.1
Host: example.org
Content-Type: application/atom+xml;type=entry
Content-Encoding: compress

...compressed payload...

Le serveur rejette la requête car il n'autorise que le Content Coding "gzip" :

HTTP/1.1 415 Unsupported Media Type
Date: Fri, 09 May 2014 11:43:53 GMT
Accept-Encoding: gzip
Content-Length: 68
Content-Type: text/plain

This resource only supports the "gzip" content coding in requests.

À ce stade, le client peut réessayer la requête avec le Content Coding "gzip" pris en charge.

Alternativement, un serveur qui ne prend en charge aucun Content Coding dans les requêtes pourrait répondre par :

HTTP/1.1 415 Unsupported Media Type
Date: Fri, 09 May 2014 11:43:53 GMT
Accept-Encoding: identity
Content-Length: 61
Content-Type: text/plain

This resource does not support content codings in requests.