gpt4 book ai didi

rest - 如果您发出 PUT 请求并且服务器上没有这样的实体怎么办?

转载 作者:可可西里 更新时间:2023-11-01 16:59:25 26 4
gpt4 key购买 nike

如果您尝试更新服务器上的实体(发出 PUT 请求),但没有这样的实体,会发生什么情况?

服务器会创建一个实体还是返回一个错误?

最佳答案

根据 HTTP/1.1 规范服务器可以创建一个新的实体:

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

If the Request-URI refers to an already existing resource, the enclosed entity SHOULD be considered as a modified version of the one residing on the origin server.

If the Request-URI does not point to an existing resource, and that URI is capable of being defined as a new resource by the requesting user agent, the origin server can create the resource with that URI.

If a new resource is created, the origin server MUST inform the user agent via the 201 (Created) response.

关于rest - 如果您发出 PUT 请求并且服务器上没有这样的实体怎么办?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50187168/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com