Content-Type header not being set with Angular $http

后端 未结 5 2094
逝去的感伤
逝去的感伤 2021-02-15 14:23

I\'m trying to make a cross-origin POST request using Angular $http with the following code.

//I\'ve tried setting and removing these http config options
$http.d         


        
5条回答
  •  臣服心动
    2021-02-15 15:13

    I face the same issue, while setting the headers. we need to send data parameter in the $http request like this

    $http({
        method: 'POST',
        headers: { 'Content-Type': 'application/json},
        data: {},
        url: url
    }); 
    

    we can send blank data also. it will work fine.

提交回复
热议问题