Previously I made a request using the following in the Headers
'Content-Type': 'application/x-www-form-urlencoded'
But now the API asks me to send it in the following way:
'Content-Type': 'application/json'
The function that performs the request is as follows:
function Authentication (data) {
var url = 'http://url';
return $http.post(url, $httpParamSerializer(datos), {
headers: {
'Content-Type': 'application/json'
}
});
};
Which gives me the following error
Error
OPTIONS http://API_URL 405 (Method Not Allowed)
XMLHttpRequest cannot load http://API_URL. Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://192.168.1.9:8100' is therefore not allowed access. The response had HTTP status code 405.
But when I use a tool, in my case ARC (Advance Rest Client) works. Which can be seen in the image
The API is hosted on an Azure server.