I try to make an http post request to a API. The problem is the follow: the API return a 200 status code, a success petition. But in my code works like in the http been an error.
My service code:
getUsers(data) {
const httpOptions = {
headers: new HttpHeaders({
"Accept": "application/json"
})
};
let input = new FormData();
input.append('firstName', data.firstName);
return this.http.post('http://localhost/post.php', input, httpOptions);
}
My component code:
callApi(data) {
this.userService.getUsers(data)
.subscribe(
(data) => { // Success
console.log(data)
},
(error) => {
console.error("Error: " + JSON.stringify(error));
}
);
}
What can be the problem?

