Http to HttpClient (Angular)
I'm trying to update the Http
requests to HttpClient
in Angular. Currently the code is:
return this.http.get(`${this.url}/grupos`).map(res => res.json());
After searches I am trying to update this way (without success):
return this.httpClient.get(`${this.url}/grupos`, { headers: {'Content-Type': 'application/json'}});
I had some issues with errors in GET/Unauthorizing
that I couldn't fix.
0
1 answers
The http client parses to JSON automatically then the Code:
return this.http.get(`${this.url}/grupos`).map(res => res.json());
Turn:
return this.httpClient.get(`${this.url}/grupos`);
0
Author: Eduardo Vargas, 2020-03-04 17:34:53