Request:body 属性
Limited availability
This feature is not Baseline because it does not work in some of the most widely-used browsers.
Request
接口的只读 body
属性包含一个 ReadableStream
,其中包含已添加到请求中的主体内容。请注意,使用 GET
或 HEAD
方法的请求不能有主体,这些情况下返回 null
。
值
示例
js
const request = new Request("/myEndpoint", {
method: "POST",
body: "Hello world",
});
request.body; // ReadableStream
规范
Specification |
---|
Fetch # ref-for-dom-body-body① |
浏览器兼容性
Report problems with this compatibility data on GitHubdesktop | mobile | server | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
body |
Legend
Tip: you can click/tap on a cell for more information.
- Full support
- Full support
- No support
- No support
- See implementation notes.
The compatibility table on 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.