Zum Hauptinhalt springen

4. Example (Beispiel)

Ein Client sendet eine POST-Anfrage mit der Content-Codierung "compress" ([RFC7231], Abschnitt 3.1.2.1):

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

...compressed payload...

Der Server lehnt die Anfrage ab, weil er nur die Content-Codierung "gzip" erlaubt:

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.

Der Client kann die Anfrage nun mit der unterstützten Content-Codierung "gzip" wiederholen.

Alternativ könnte ein Server, der keine Content Codings in Anfragen unterstützt, wie folgt antworten:

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.