知识卡片
幂等性与重复请求
幂等关注多次请求对服务状态的净效果,响应本身可以不同。FarmStall 每次 POST 创建一个新评价,相同正文的重试也可能写入两次。若要让调用方安全重试,契约和服务实现还需要明确的重复请求处理机制。
这张卡片看不懂?
这张卡片已通过人工审查,不再接受失败反馈。
已有反馈 · 0 条
还没有人提交反馈。
在整书笔记中的位置
原书出处 · 1 处
- Creating resources 6.2 Describing POST /reviews with a request body · 查看原书依据
Definition Idempotent: Can be applied multiple times without changing the result beyond the first execution. In other words, executing it five times has the same effect as executing it once.
参考来源
- 位置:《Designing APIs with Swagger and OpenAPI》第06章《Creating resources》(来源项目 book-source:extracted/Designing APIs with Swagger and OpenAPI/_epub-src/OEBPS/Text/ch06.htm,阅读块 35)
- 结论依据:原文定义重复执行的效果等同执行一次。
- 原始内容:Definition Idempotent: Can be applied multiple times without changing the result beyond the first execution. In other words, executing it five times has the same effect as executing it once.