0 votes
in Angular by
How can you read full response?

1 Answer

0 votes
by

The response body doesn't or may not return full response data because sometimes servers also return special headers or status code, which are important for the application workflow. In order to get the full response, you should use observe option from HttpClient:

getUserResponse(): Observable<HttpResponse<User>> {

  return this.http.get<User>(

    this.userUrl, { observe: 'response' });

}

Now HttpClient.get() method returns an Observable of typed HttpResponse rather than just the JSON data.

...