http.post is not working

Asked

Viewed 218 times

1

I am trying to submit a form to an API with the http post. Angular, but I’m not getting it:

Code:

save(auditoria):Observable <{}>{
    let headers = new Headers();
        headers.append('Content-Type', 'application/json');
    let options = new RequestOptions({ headers: headers });

    return this.http.post(`${Utils.WEBSERVICE}/api/audit`, auditoria, options).map( (res:Response) => res.json());
}

This is how it looks on the console

Request URL:http://147.1.5.114/webservice/api/Audit

Request Method:OPTIONS

Status Code:404 Not Found


In my API there is nothing that receives Verb Options, when I do the same sending using the POSTMAN everything happens normal, only it doesn’t work for the application I’m building.

  • You have enabled CORS in your Backend?

  • @Hiagosouza, is enabled yes

  • Even if I make the same request using Postman, it works well

  • See if endpoint really is this and check the format of the data you are going through, make sure the json payload matches the expected data on the server.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.