我很努力讓AngularJS將HTTP Content-Type
標頭設置爲application/json
。我已經看到,它通常是這樣做的:AngularJS沒有設置'Content-Type':'application/json'
$http({
method: 'POST',
url: 'http://myurl.com',
data: {
"key":"value"
},
headers : {
'Content-Type' : 'application/json'
}
})
但是,這似乎並沒有這樣做。檢查Chrome的頭,我看不出有任何Content-Type
頭:
我已經能夠獲得請求的郵差工作,具有以下設置:
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"
}
有什麼想法嗎?我在這裏做錯了什麼?
我沒有訪問服務器的一個例子。我已經能夠得到在郵差工作的請求,而不是在Angular中。 – charlierproctor