幂等性是否包含响应代码? [英] Does idempotency include response codes?

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

问题描述

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

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邮件列表上询问了这个问题并被告知 idempotency不包括返回代码。这意味着,只要后续请求不会更改服务器状态,您就可以在第一次删除资源时自由返回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.

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

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