Last active
May 19, 2019 11:10
-
-
Save PyroGenesis/6d1a883b75703c4354103e9762299361 to your computer and use it in GitHub Desktop.
Angular request with Headers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// GET request with headers | |
GET_with_headers(): Observable<any> { | |
const URL = 'YOUR_URL_HERE'; | |
const headers: new HttpHeaders({ | |
'Content-Type': 'application/json', | |
'Authorization': 'my-auth-token' | |
}) | |
return this.httpClient.get(URL, { headers: headers }); // returns an Observable | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment