Skip to content

Instantly share code, notes, and snippets.

@PyroGenesis
Last active May 19, 2019 11:10
Show Gist options
  • Save PyroGenesis/6d1a883b75703c4354103e9762299361 to your computer and use it in GitHub Desktop.
Save PyroGenesis/6d1a883b75703c4354103e9762299361 to your computer and use it in GitHub Desktop.
Angular request with Headers
// 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