Answer the question
In order to leave comments, you need to log in
Why isn't an angular 5 http.put request sent?
Why can’t I send a Put request to Angular 5, get works, put doesn’t, although it is sent via postman.
update(user: User) {
const httpOptions = {headers: new HttpHeaders({'Content-Type': 'application/json',})};
let url = '/api/' + user.id;
this.http.put(url, user, httpOptions);
}
Answer the question
In order to leave comments, you need to log in
I figured it out, today I launched the server and the application again and it worked, this is the right decision.
thank you everyone, everyone is free :))
UPD A feature was noticed, there is a suspicion that the problem was that I did not subscribe to the update
, that is, when it was like this.http.put(url, user, httpOptions);
that, the request was not sent, and when I added a signature to the answer, like this
start sending requestthis.http.put(url,user,httpOptions).subscribe(data=>console.log(data));
update(user: User) {
const httpOptions = {headers: new HttpHeaders({'Content-Type': 'application/json',})};
let url = '/api/' + user.id;
this.http.put(url, user, httpOptions).subscribe(data=>console.log(data));
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question