gpt4 book ai didi

javascript - Node js/Angular js - 注意 : Provisional headers are shown

转载 作者:数据小太阳 更新时间:2023-10-29 05:50:02 25 4
gpt4 key购买 nike

<分区>

这是我的Angular js片段代码:

$http({
method:'POST',
withCredential:true,
url:$scope.config.app_ws+'auth/signup',
data:{user:$scope.auth}
}).success(function(status, response){

console.log(response);
}).error(function(status, response){
alert(response+'Bummer :( , an error occured plese retry later. ');
});

这是我的 Node.js 后端:

 var allow_cross_domain= function(req, res, next) {
res.header('X-Powered-By', 'hey.heyssssssss.org');

var oneof = false;
if(req.headers.origin) {
res.header('Access-Control-Allow-Origin', req.headers.origin);
oneof = true;
}
if(req.headers['access-control-request-method']) {
res.header('Access-Control-Allow-Methods', req.headers['access-control-request-method']);
oneof = true;
}
if(req.headers['access-control-request-headers']) {
res.header('Access-Control-Allow-Headers', req.headers['access-control-request-headers']);
oneof = true;
}
if(oneof) {
res.header('Access-Control-Max-Age', 60 * 60 * 24 * 365);
}
// intercept OPTIONS method
if (oneof && req.method == 'OPTIONS') {
res.send(200);
} else {
next();
}
}

app.use(allow_cross_domain);

app.post('/auth/signup', function (req, res) { res.send('wtff'); });

我只是从 Angular 调用 POST localhost:3000/auth/signup 到 Node,但我得到 **CAUTION : Provisional headers are shown.** 在 chrome 控制台中。

Chrome (CAUTION):

enter image description here

Firefox (NO RESPONSE for about 30/60 seconds and then the alert() comes up :/ ):

enter image description here

这可能是什么?

如果我使用 GET 一切正常,只是使用 POST 时出现问题,这怎么可能?

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com