My code in coffeescript :
我在coffeescript中的代码:
resource = $resource GlobalService.apiRoot + "stuffs", {},
get:
method: "GET"
headers:
"Accept": "application/stuffs;version=3"
"Authorization": 'Token token="' + $.cookie('token') + '"'
My code in javascript :
我在javascript中的代码:
var resource;
resource = $resource(GlobalService.apiRoot + "stuffs", {}, {
get: {
method: "GET",
headers: {
"Accept": "application/stuffs;version=3",
"Authorization": 'Token token="' + $.cookie('token') + '"'
}
}
});
Then when I do..
那我什么时候..
resource.get ->
It doesn't send out those specified headers, and effectually fails the CORS authorization.
它不发送那些指定的头,并且有效地失败了CORS授权。
Any recommendations?
1 个解决方案
#1
4
Looks like that headers setting is only available in the latest "unstable" release of Angular. If you use this, be sure to upgrade both angular.js and angular.resource.js to 1.1.2 (current unstable release).
看起来标题设置仅在Angular的最新“不稳定”版本中可用。如果使用它,请确保将angular.js和angular.resource.js升级到1.1.2(当前不稳定版本)。
#1
4
Looks like that headers setting is only available in the latest "unstable" release of Angular. If you use this, be sure to upgrade both angular.js and angular.resource.js to 1.1.2 (current unstable release).
看起来标题设置仅在Angular的最新“不稳定”版本中可用。如果使用它,请确保将angular.js和angular.resource.js升级到1.1.2(当前不稳定版本)。