HTTP协议中 204 No Content
成功状态响应码表示目前请求成功,但客户端不需要更新其现有页面。204 响应默认是可以被缓存的。在响应中需要包含头信息 ETag
。
使用惯例是,在 PUT
请求中进行资源更新,但是不需要改变当前展示给用户的页面,那么返回 204 No Content。如果新创建了资源,那么返回 201
Created
。如果页面需要更新以反映更新后的资源,那么需要返回 200
。
状态
- 204 No Content
规范
Specification | Title |
---|---|
RFC 7231, section 6.3.5: 204 No Content | Hypertext Transfer Protocol (HTTP/1.1): Semantics and Content |
浏览器兼容性
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
Update compatibility data on GitHub
Desktop | Mobile | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | Android webview | Chrome for Android | Edge Mobile | Firefox for Android | Opera for Android | Safari on iOS | Samsung Internet | |
204 | ChromeFull support Yes | EdgeFull support Yes | FirefoxFull support Yes | IEFull support Yes | OperaFull support Yes | SafariFull support Yes | WebView AndroidFull support Yes | Chrome AndroidFull support Yes | Edge MobileFull support Yes | Firefox AndroidFull support Yes | Opera AndroidFull support Yes | Safari iOSFull support Yes | Samsung Internet AndroidFull support Yes |
Legend
- Full support
- Full support
参见
文档标签和贡献者
标签:
此页面的贡献者:mdnwebdocs-bot, WayneCui, fscholz, abc950309
最后编辑者:mdnwebdocs-bot,