POST/Redirect/GET (PRG) vs. meaningful 2xx response codes

后端 未结 2 1010
迷失自我
迷失自我 2021-02-07 20:56

Since the POST request in a POST/Redirect/GET (PRG) pattern returns a redirect (303 See Other) status code on success, is it at all possible to inform the client of

相关标签:
2条回答
  • 2021-02-07 21:40

    If you have control over the web server, how about differentiating between the Agent header ? Fill it in something only you know of (a GUID or other pseudo-random thing) and present that one to the webserver from the automated client. Then have the webserver response with 201 / 303 accordingly.

    0 讨论(0)
  • 2021-02-07 21:41

    Send human-targetted information in the response body as HTML. Don't differentiate on the User-Agent header; if you also need to send bodies to machines, differentiate based upon the Accept request header.

    0 讨论(0)
提交回复
热议问题