I am trying to add headers to my API as follows,
import { HttpClient, HttpHeaders } from '@angular/common/http';
constructor(private httpClient:HttpClient) {
let headers = new HttpHeaders();
this.headers = headers.set('test', 'test-headers');
}
getInitialData(q: string) {
return this.httpClient.get<InitialResponse>(`${this.serverUrl}/getInitialData?` + query, this.headers).toPromise();
}
When I check in the network tab, I am not able to see the header ‘test’. Can anyone please suggest what I am missing here. Thanks.
When I check in the network tab, I am not able to see the header ‘test’. Can anyone please suggest what I am missing here. Thanks.