如何发出HTTP PUT请求?

编程入门 行业动态 更新时间:2024-10-23 06:17:58
本文介绍了如何发出HTTP PUT请求?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我知道HTTP PUT是一个幂等请求,根据定义(引自 rfc )

I know HTTP PUT is an idempotent request that store something at a specific URI, according to the definition (quoted from the rfc)

The PUT method requests that the enclosed entity be stored under the supplied Request-URI.

但是'封闭实体'的定义是什么?我似乎无法发送表单数据(如HTTP POST请求)。如何通过JSON / XML或其他序列化格式发送实体的表示?

But what is the definition of 'enclosed entity'? It doesn't seem possible for me to send form data (like for HTTP POST request) over. What about sending representation of the entity via JSON/XML or in other serialization formats?

简而言之,如何将HTTP PUT请求发送到存储/更新信息然后是一个特定的URI?

In short, how does one send a HTTP PUT request over to store/update info at a specific URI then?

推荐答案

包含的实体是HTTP消息体中包含的有效负载数据(在任何传输编码之后)如果您在发送邮件正文时遇到问题,那么您可能忘记包含Content-Length标头 - 这是表明HTTP邮件有正文的两种方法之一。

The enclosed entity is the payload data contained in the HTTP message body (after any transfer encodings have been removed.) If you're having trouble sending the message body then it could be that you've forgotten to include a Content-Length header - that's one of two ways to indicate that the HTTP message has a body.

除了这种语义差异外,PUT与POST相同:使用POST,URI标识将处理实体的资源,例如servlet。使用PUT,URI标识实体本身,例如将使用实体主体的内容创建/替换的文件。

PUT is the same as POST except for this semantic difference: With POST the URI identifies a resource that will handle the entity, such as a servlet. With PUT the URI identifies the entity itself, for example a file that will be created/replaced with the contents of the entity body.

更多推荐

如何发出HTTP PUT请求?

本文发布于:2023-06-05 19:39:27,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/526447.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:HTTP   PUT

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!