我可以使用 GET 请求来提交 HTML 表单数据。如果 HEAD 请求在功能上与 GET 相同(不包括响应中的内容),那么我是否应该能够使用 HEAD 提交 HTML 表单数据?
HTTP 请求的第一行可能如下所示:
HEAD /processdata.php?first=john&last=doe&<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="70151d11191c4d1a1f181e30141f155e131f1d" rel="noreferrer noopener nofollow">[email protected]</a> HTTP/1.1
RFC 2616说:
The HEAD method is identical to GET except that the server MUST NOT return a
message-body in the response.
(几乎是 this question 的骗局,除了我想知道是否可以提交 HTML 表单数据。)
基于规范的响应值得赞赏。 TIA。
最佳答案
HEAD 与 GET 相同,只是响应不携带负载。
所以,是的,您可以使用 GET 发送任何内容。
关于http - 我可以使用 HTTP HEAD 请求发布表单数据吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8141269/