Can't read custom header in HttpResponse from HttpClient in a Ionic Angular application

前端 未结 3 1620
名媛妹妹
名媛妹妹 2020-12-03 08:48

I\'m requesting an endpoint that creates a new resource and returns a 201 response containing a \"Location\" header with the newly created resource:

However

3条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-03 09:28

    I had that problem too. In my case I saw only Content-Type, Pragma and Expiration headers.

    In fact, that is not a Angular issue. The reason that there are not headers that you expect is a CORS.

    Adding 'access-control-expose-headers' : 'Location' on the API solves your problem :)

提交回复
热议问题