1

I am using HttpClient in Angular. The documentation says:

All HttpClient methods return an RxJS Observable of something...HttpClient.get returns the body of the response as an untyped JSON object by default

Does this mean that in the following code, res is the HTTP message body (excluding the headers)?

this.http.post('http://localhost:8083', body, options)
    .map((res) => { res.json(); console.log('got response'); })

How could I get the HTTP headers if I want to see that a certain header is present in the server's response?

Daniel W Strimpel
  • 8,190
  • 2
  • 28
  • 38
Manu Chadha
  • 15,555
  • 19
  • 91
  • 184
  • Thanks @Kalanamith. I am checking this. Could you please also take a look at https://stackoverflow.com/questions/50076352/angular-is-not-sending-the-cookie-received-in-set-cookie-even-if-withcredentials I am stuck at this for sometime now and have no clue how to solve this – Manu Chadha May 01 '18 at 22:07
  • seems you are not setting cookies – not 0x12 May 01 '18 at 22:13
  • sorry, I dont follow. Could you please elaborate. I assume that when the server sends `Set-Cookie`, the client would automatically send the cookies in subsequent requests. Isn't it? How do I explicitly set the cookie in Angular? Also, could we please take this conversation to the question page. Others might find your answer helpful – Manu Chadha May 01 '18 at 22:16
  • @Kalanamith - any idea what I might be doing wrong in the problem in which Angular is not returning Cookie? Could you please comment on that question thread. – Manu Chadha May 02 '18 at 18:58
  • I cannot give a comment without seeing your whole working code – not 0x12 May 02 '18 at 21:27
  • I understand. The issue is resolved now. – Manu Chadha May 03 '18 at 09:04

0 Answers0