How does doing the same post request twice create duplicate for the same resource. From what I learnt and understood, whenever someone does
POST api/users/reg
我必须注册用户并为特定用户创建资源 URL。
现在如果有人试图在给定的 api 上注册相同的数据,它应该如何创建重复的资源。它会响应一个错误,表明用户名已被占用。
最佳答案
重新考虑您的 API 设计。资源类型users可能有多个具有唯一资源id的用户。
api/users/reg/:userId
通过这种方式,您可以发布任意数量的用户,因为每次 ID 都不同。
关于rest - POST请求两次,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34714098/