Redirecting with a 201 created

后端 未结 4 1868
无人及你
无人及你 2021-02-03 21:30

Is there a way to redirect through a 201 answer?

The RFC specifies that the newly created resource must be specified in the Location header, and I do specif

4条回答
  •  忘了有多久
    2021-02-03 22:13

    The browser will enact a redirect action through one of the 3xx status codes, the specification doesn't define that a user agent must redirect with a 201. You could try sending a refresh header to see if it forces a redirect to the Location header, but I wouldn't count on it. Why not stick with a 3xx response?

提交回复
热议问题