I am using HttpClient from '@angular/common/http' and wanted to perform put operation.
My Angular code is like :
public updateDetails(data: Data) {
const url = '/project/rest/v1/configuration/device/update'
console.log(JSON.stringify(data));
let headers = new HttpHeaders();
headers.append('Content-Type' , 'application/json');
let body = JSON.stringify(data);
return this.http.put(url, data, { headers: headers })
.map(response => true)
.catch(err => {
console.log(err);
return Observable.of(false);
});
}
But, i am getting
HttpErrorResponse {headers: HttpHeaders, status: 400, statusText: "Bad Request",
Please help me what i am missing. I tried to pass the data in stringfy format but that is also giving me same error.
JSON.stringify()it first. - Randy Casburn