知识卡片

普通读书笔记卡 · 4545.e.3.a.1

幂等不要求响应完全相同

理解等级:高级

幂等约束重复相同请求对服务器的预期效果,不要求每次状态码或响应内容完全一致。删除已删资源可返回不同状态而仍不增加新副作用;“CRUD重复会报错所以必不幂等”不是充分判断。原稿这里把效果与返回混淆,应按核心业务状态和并发前提判断,HTTP方法名也不会强制实现正确。

这张卡片看不懂?

已有反馈 · 0 / 10 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • Resilience · 查看原书依据

      Idempotence isn’t baked into the logic of any particular framework. Even in HTTP — and by extension, REST — idempotence is a matter of convention and isn’t explicitly enforced. There’s nothing stopping you from — by oversight or on purpose — implementing a non-idempotent GET if you really wanted to16. One of the reasons that

    参考来源

    - 位置:《Cloud Native Go》第09章《Resilience》(来源项目book-sources;源文件:extracted/Cloud Native Go (Matthew A. Titmus)/_epub-src/OEBPS/ch09.xhtml) - 结论依据:幂等约束重复相同请求对服务器的预期效果,不要求每次状态码或响应内容完全一致。原文相应定义、示例或限制为此结论提供依据;补充纠错与版本边界在正文就近标明。 - 原始内容:Idempotence isn’t baked into the logic of any particular framework. Even in HTTP — and by extension, REST — idempotence is a matter of convention and isn’t explicitly enforced. There’s nothing stopping you from — by oversight or on purpose — implementing a non-idempotent GET if you really wanted to16. One of the reasons that