【发布时间】:2017-09-09 09:30:50
【问题描述】:
我想使用 AngularJS $http 在 Google Contacts API 上进行发布请求。
我试过这样做:
var config = {
headers: {
// "Content-Type": "application/json",
"Authorization": "Bearer " + gapi.auth.getToken().access_token,
"GData-Version": "3.0"
}
}
var data = {
"test": "test"
}
$http.post('https://www.google.com/m8/feeds/contacts/default/full/', data, config);
但它返回“XMLHttpRequest 无法加载 https://www.google.com/m8/feeds/contacts/default/full/。预检响应具有无效的 HTTP 状态代码 405”
此请求正在像 Postman 这样的 RestClient 上运行(返回 201 创建)。
如果有人可以向我解释为什么浏览器不允许使用此方法。
【问题讨论】:
-
$http.get这不是发帖请求... -
我的错,我正在使用帖子^^
标签: angularjs http google-api google-contacts-api