浏览器中的 HTTP PATCH 支持 [英] HTTP PATCH support in browsers

查看:64
本文介绍了浏览器中的 HTTP PATCH 支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在为我的应用程序设计 REST 端点,我需要对一些端点使用 PATCH.所有支持 HTTP/1.1 的浏览器都能支持 PATCH 吗?

I am designing REST endpoints for my application and i need to use PATCH for a few of the endpoints. Will all browsers that support HTTP/1.1 be able to support the PATCH ?

推荐答案

HTTP/1.1 没有定义 PATCH 方法.

HTTP/1.1 did not define the PATCH method.

HTTP/1.1 确实允许客户端和/或服务器添加新方法.

HTTP/1.1 does leave itself open for clients and/or servers to add new methods.

RFC 5789 定义了使用 PATCH 方法.

RFC 5789 defined the conventions for using the PATCH method.

HTTP 请求中定义的方法只不过是一个字符串.浏览器应该允许 JavaScript 在 XmlHttpRequest 中使用它想要的任何 HTTP 方法;有关详细信息,请参阅此问答.简而言之,任何现代浏览器都允许您执行此操作,即过去几年的 IE9+ 和 Firefox/Chrome/Safari/Opera/Spartan.

The method defined within a HTTP request is nothing more than a string. Browsers should allow JavaScript to use whatever HTTP method it wants in the XmlHttpRequest; see this Q&A for more info. In short, any modern browser will allow you to do this, i.e. IE9+ and Firefox/Chrome/Safari/Opera/Spartan from the last few years.

另外,不要忘记服务器也需要专门处理 PATCH 方法,它不会神奇地发生.

Also, don't forget the server needs to specifically handle the PATCH method too, it doesn't just magically happen.

这篇关于浏览器中的 HTTP PATCH 支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆