Skip to content
On this page

浏览器对 get,head 方法的 body 的限制

虽然 http 本身不限制 get 方法带 body,但其实不推荐这么做。

用桌面端软件或服务端发出 get 带 body 的请求可行,不过浏览器对此做了限制,在对 XHR 的规范( https://xhr.spec.whatwg.org/#the-send()-method)中,send()方法有一条

If this’s request method is `GET` or `HEAD`, then set body to null.

而且控制台也看不到 body。

MIT Licensed