How to get Header Location value from a Fetch request in browser

后端 未结 2 728
爱一瞬间的悲伤
爱一瞬间的悲伤 2021-01-04 21:29

From a ReactJS - Redux front app, I try to get the Location Header value of an REST API response.

When I Curl this :

curl -i -X POST -H \"Authorizat         


        
2条回答
  •  太阳男子
    2021-01-04 22:00

    Thanks to John, I've found the answer.

    I just had to put

    Access-Control-Expose-Headers: Location
    

    To my response headers and it worked, so now I can access Location value with :

    response.headers.get('Location');
    

    Thx John !

提交回复
热议问题