I'm struggling to get AngularJS to set the HTTP Content-Type
header to application/json
. I've seen that it's often done as such:
$http({
method: 'POST',
url: 'http://myurl.com',
data: {
"key":"value"
},
headers : {
'Content-Type' : 'application/json'
}
})
But this doesn't seem to do it. Inspecting the headers in Chrome, I don't see any Content-Type
header:
I've been able to get the request to work in POSTMAN, with the following settings:
POST /run HTTP/1.1
Host: myurl.com:80
Content-Type: application/json
Cache-Control: no-cache
Postman-Token: 5470283d-0f71-93a0-32ff-cc2fa4395eaa
{
"key" : "value"
}
Any thoughts? What am I am doing wrong here?