postServers(servers: any[]) { const headers = new HttpHeaders().set('Content-Type', 'application/json'); this.http.post('https://angularsamples.firebaseio.com/data.json', servers, { headers: headers }).subscribe(value => { console.log(value); }); } putServers(servers: any[]) { const headers = new HttpHeaders().set('Content-Type', 'application/json'); this.http.put('https://angularsamples.firebaseio.com/data.json', servers, { headers: headers }).subscribe(value => { console.log(value); }); }
References
https://angular.io/guide/http#adding-headers