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?
– Hiago Souza
@Hiagosouza, is enabled yes
– Tafarel Brayan
Even if I make the same request using Postman, it works well
– Tafarel Brayan
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.
– DiegoAugusto