0

I'm trying to get all headers from the response to a post method:

this.http.post<User>(this.url, user, {
        observe: 'response',
        responseType: 'json',
      })
      .subscribe((res) => {
        console.log('Headers: ' + JSON.stringify(res.headers));
      });
}

earlier:

url = 'http://localhost:8080/user/login';
constructor(private http: HttpClient) {}

I followed most tutorials and stackoverflow answers, but I get only two headers: Headers: {"normalizedNames":{},"lazyUpdate":null}

When I tried with postman and curl everything works fine, that is I get all the headers, but not in Angular (I'm using version Angular CLI: 15.2.8)

0

1 Answer 1

1

Check this one - Angular HttpClient missing response headers

In your case seems that second answer might help you, about headers being lazy loaded

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.