当angularjs http请求有空错误时会发生什么?

时间:2017-12-18 10:45:31

标签: angularjs http response

在我的AngularJS(1.5)应用程序中,我使用$ http服务调用我的后端端点,如下所示:

$http.post('url', _params).then(function (response) {

}).catch(function (error) {

});

间歇性地,我的错误回来了。没有状态或错误代码或类似的东西。可能是什么原因?我在客户端计算机上有完美的Internet连接。

编辑:状态代码实际为-1。 以下是回复的示例:

                "data": null,
                "status": -1,
                "config": {
                    "method": "POST",
                    "transformRequest": [
                        null
                    ],
                    "transformResponse": [
                        null
                    ],
                    "timeout": 8000,
                    "cache": false,
                    "url": "https://myurl",
                    "data": {
                        "username": "hello"
                    },
                    "headers": {
                        "Accept": "application/json, text/plain, */*",
                        "Content-Type": "application/json;charset=utf-8"
                    }
                },
                "statusText": ""

0 个答案:

没有答案
相关问题