幂等性是否包含响应代码

幂等性是否包含响应代码

本文介绍了幂等性是否包含响应代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对幂等方法的重复请求是否必须返回相同的响应代码?

Do repeated requests to idempotent methods have to return the same response code?

很多其他人相同的问题,并以矛盾的答案结束。答案应该引用有关此事的权威来源。

A lot of other people are asking the same question and ending up with contradicting answers. The answer should reference an authoritative source on the matter.

推荐答案

我并被告知。这意味着,只要后续请求不会更改服务器状态,您就可以在第一次删除资源时自由返回HTTP 204,以及稍后的HTTP 404。

I asked this question on the HTTP mailing list and was told that idempotency does not include return codes. Meaning, you are free to return HTTP 204 the first time a resource is deleted, and HTTP 404 at a later time, so long as the subsequent request does not change the server state.

虽然后续请求确实可能不会更改服务器状态,但响应代码不会被视为该状态的一部分。

While it is true that subsequent requests may not change the server state, the response codes are not considered part of that state.

这篇关于幂等性是否包含响应代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-28 12:44