I have an Ionic 2 application using Angular 2, which is sending an Http PUT to a ASP.NET Core API server. Here\'s the method I\'m using to send the request:
The simpler and current approach for adding header to a single request is:
// Step 1
const yourHeader: HttpHeaders = new HttpHeaders({
Authorization: 'Bearer JWT-token'
});
// POST request
this.http.post(url, body, { headers: yourHeader });
// GET request
this.http.get(url, { headers: yourHeader });