Parse platform 云代码:HTTPResponse状态代码302

Parse platform 云代码:HTTPResponse状态代码302,parse-platform,Parse Platform,我正在Parse Cloud中尝试此POST函数,并使用http响应代码302抛出错误。有人能告诉我怎么解决这个问题吗 Parse.Cloud.httpRequest({ method: 'POST', url: 'http://siteabcd.com/auth.action', body: { username: 'user', password: 'pass', butt

我正在Parse Cloud中尝试此POST函数,并使用http响应代码302抛出错误。有人能告诉我怎么解决这个问题吗

Parse.Cloud.httpRequest({
        method: 'POST',
        url: 'http://siteabcd.com/auth.action',
        body: {
            username: 'user',
            password: 'pass',
            button: 'Login',
        },  
        headers: {
            'User-Agent' : "Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.2) Gecko/20100316 Firefox/3.6.2"
        },
        success: function(httpResponse){
            alert("response:"+httpResponse.text+"---header length:"+httpResponse.headers.length);
                response.success("Message Sent");
        },
        error: function(httpResponse){
        console.error('Request failed with response code ' + httpResponse.status);
            response.error("Message Not Sent");
        }
    });

302
表示URL进行重定向:


正如@dimitri所指出的
302
意味着重定向。例如,如果您转到
http://google.com
在瑞典,谷歌最有可能首先发送302响应,然后转到
http://google.se
。也可能是域从
http
版本重定向到
https
或类似版本

Parse在其sdk中还不支持重定向。解决这个问题的最简单方法是查看302响应
res.get('Location')中的Location头
并相应地更新发送请求的url