2
I need to send three values in my header in http request, but when I check in the browser I realize that my headers have not been sent.
I tried something like:
trocaToken(token):Observable<any>{
const _headers = new HttpHeaders();
const headers = _headers.append('Content-Type', 'application/x-www-form-urlencoded');
headers.append('token', token);
headers.append('Authorization', 'bearer ' + token);
return this._http.post<Usuario>(AppSettings.API_ENDPOINT + 'admin/detalhes',
{headers: headers})
}
When the request is Post the First given after the comma is Body, Tries to do:
trocaToken(token):Observable<any>{
 const _headers = new HttpHeaders();
 const headers = _headers.append('Content-Type', 'application/x-www-form-urlencoded');
 headers.append('token', token);
 headers.append('Authorization', 'bearer ' + token);
 return this._http.post<Usuario>(AppSettings.API_ENDPOINT + 'admin/detalhes', { } , 
 {headers: headers})
 }
– Lucas Brogni
you are using http.post or httpClient?
– Leandro Angelo
@Leandroangelo by the method used (post with typing in <>), she is using Httpclient.
– mutlei
@mutlei Well observed
– Leandro Angelo