Kinvey AngularJS 图片上传 Content-Type Header

Kinvey AngularJS Image Upload Content-Type Header

我正在使用 Kinvey 的 AngularJS 库。现在,我可以成功将图像上传到 Kinvey 的 Files。我看到我的图像文件已成功上传。问题是我从上传功能的承诺中得到一个错误。

图片文件:

$scope.onFileSelect = function(element) {
    if (element.files[0]) {
        $scope.selectedImage = element.files[0];
    }
    console.log($scope.selectedImage);
};

上传功能:

var promise = $kinvey.File.upload($scope.selectedImage, {
    mimeType  : $scope.selectedImage.type,
    size      : $scope.selectedImage.length
});

promise.then(function(response) {
    console.log('Uploaded image successfully');
    uikit.notificationTop('Uploaded new image', 'success');
    console.log(response);
}, function(err) {
    uikit.notificationTop('Error in uploading new image', 'danger');
    console.log(err);
});

这是我遇到的错误:

Error: Response Content-Type header is set to text/html; charset=UTF-8. Expected it to be set to application/json.

Kinvey 的团队注意到了这个错误问题并修复了它。

1.6.8 - Feb 10, 2016

Bugfix: Do not check response type for file uploads from Google. Bugfix: Do not send an empty username/password in a login request.

谢谢金维!