How to set header to HttpHeaders in angular 5 [duplicate]
问题 This question already has answers here : Adding a HTTP header to the Angular HttpClient doesn't send the header, why? (8 answers) Interceptor Angular 4.3 - Set multiple headers on the cloned request (4 answers) Closed 2 years ago . I'm trying to figure out how to handle headers on HttpHeaders to use them for http requests via HttpClient. const headers = new HttpHeaders(); headers.append('foo', 'bar'); headers.set('foo', 'bar'); console.log(headers.get('foo')) // null it works only this way: