I am calling a service from an Angular application, the service sends an email.
The method in Angular that calls the service to send an email:
sendEmailRegister(url, email, language) {
var headers = this.authorizationService.initParamAuthorization(true); // capture token
headers["language"] = language;
headers["Content-Type"] = 'application/x-www-form-urlencoded';
let body = 'email='+encodeURIComponent(email);
return this.httpClient.post<any>(url, body, { 'headers':headers }).toPromise();
}
Analyzing the service in the Chrome browser tab "Network" I see that the service returns a status 500 error and when I access the "Response" it gives me a 401 error.
The funny thing is that when I do a "Copy as curl (Windows)" from the "Network" tab and then import from Postman using the "Raw text" tab to generate the request, it works correctly and sends the mail.
Capture call with OPTIONS method:
What could be the problem? Thanks.