I am implementing REST routes in my server which return a new URL every time, but don't change any server "state".
In particular, I'm writing a route similar to this:
GET/POST example.com/upload-url
What this route does is creates a unique URL that the caller can then use to securely upload a file to the server. Specifically, it will create an S3 presigned put request, and return it. The route handler does not create the file in S3. You can also call this REST route 3 times in a row and have no effect on the server. It also will not invalidate other URLs returned by the server.
For example, suppose you call this route 3 times in a row:
The three returns will be different, and might be:
example.com/aaa example.com/bbb example.com/ccc Each of the returned URL have their own expiration time. Until each one expires, it is completely valid. You could then use each URL, and your file would be uploaded. One caveat, if you uploaded a file using example.com/aaa and then uploaded a different file using example.com/bbb, the file you uploaded using aaa would be overwritten.
The question is - defined this way, is GET example.com/upload-url idempotent?
没有评论:
发表评论