我在 Tumblr 和 Angular 方面遇到了一个我无法弄清楚的 API 问题。当使用 $http 尝试从某个博客获取信息时,它会保持“预检响应无效”。我想我在看这段代码时会有点眼花缭乱。有人会看看这个并告诉我我做错了什么吗?谢谢。
$scope.tumblrKey = 'mldv2B4xUD5roLX8XfbYdgJhzlgLxfm8mBRuKQhBxXsUFLiqEx';
$scope.tumblrUrl = 'http://api.tumblr.com/v2/blog/whileoutriding.tumblr.com/info?api_key=';
$http({
method: 'GET',
headers: {
'Authorization': $scope.tumblrKey
},
url: $scope.tumblrUrl + $scope.tumblrKey
}).then(function successCallback(response) {
console.log('it worked', response);
}, function errorCallback(response) {
console.log('it did not work', response);
});