跳到主要内容

4. Example (示例)

客户端使用 "compress" Content Coding ([RFC7231] 第 3.1.2.1 节) 提交 POST 请求:

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

...compressed payload...

服务器拒绝该请求, 因为它仅允许 "gzip" Content Coding:

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.

此时, 客户端可以使用所支持的 "gzip" Content Coding 重试请求.

或者, 不支持请求中任何 Content Coding 的服务器可以如下响应:

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.