javascript - accessing response header via Axios - Stack Overflow

I'm using Axios to make a secure POST call to an API.This returns an URL within the response head

I'm using Axios to make a secure POST call to an API. This returns an URL within the response headers under 'Location'.

I can see the URL being populated within Chrome's dev tools:

but the response inside JS from Axios (below) doesn't contain this information:

Any advice greatly received!

I'm using Axios to make a secure POST call to an API. This returns an URL within the response headers under 'Location'.

I can see the URL being populated within Chrome's dev tools:

but the response inside JS from Axios (below) doesn't contain this information:

Any advice greatly received!

Share Improve this question edited Jun 20, 2020 at 9:12 CommunityBot 11 silver badge asked Jul 11, 2017 at 14:27 RichRich 1,0512 gold badges18 silver badges43 bronze badges 2
  • Possible duplicate of Axios get access to response header fields. – Rita Kondratyeva Commented Sep 2, 2017 at 17:31
  • Please find another detailed discussion regarding the same here – Apurva jain Commented Oct 2, 2017 at 14:57
Add a ment  | 

1 Answer 1

Reset to default 2

Possibly it occurs because you are doing a cors request that doesn't expose location header by default.

You need to add this Cors Configuration to your server side app.

Access-Control-Expose-Headers: Location

as you can see here: https://developer.mozilla/en-US/docs/Web/HTTP/Headers/Access-Control-Expose-Headers

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745273100a4619871.html

相关推荐

  • javascript - accessing response header via Axios - Stack Overflow

    I'm using Axios to make a secure POST call to an API.This returns an URL within the response head

    1小时前
    10

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信