Steam Post Request - 无法加载资源:服务器响应状态为400(错误请求)

Var*_*yer 9 javascript apache .htaccess post steam

我正在尝试发送这样的帖子请求:

xhr.open("POST", "/steamapi/actions/RemoveFriendAjax", false);
    var params = "sessionID="+session_id+"&steamid="+id;
    xhr.onreadystatechange = function() {//Call a function when the state changes.
        if(xhr.readyState == 4 && xhr.status == 200) {
            alert(xhr.responseText);
        }
    }   
xhr.send(params);
Run Code Online (Sandbox Code Playgroud)

我正在使用Apache服务器,这是我的.htaccess文件

RewriteEngine On
RewriteRule ^api/(.*)$ http://api.steampowered.com/$1 [P]
RewriteRule ^(.*)$ http://steamcommunity.com/$1 [P]
 <IfModule mod_headers.c>
    Header add Access-Control-Allow-Origin "*"
    Header add Access-Control-Allow-Headers "origin, x-requested-with, content-type"
    Header add Access-Control-Allow-Methods "PUT, GET, POST, DELETE, OPTIONS"
 </IfModule>
Run Code Online (Sandbox Code Playgroud)

每当我发送请求时,我都会收到此错误:

Failed to load resource: the server responded with a status of 400 (Bad Request) 
enter code here
Run Code Online (Sandbox Code Playgroud)

为什么会这样?我已经使用了Steam的GET请求并且它们工作正常,这个POST请求似乎不起作用.

编辑:这是steamcommunity.com's robot.txt文件:

User-agent: *
Disallow: /actions/
Disallow: /linkfilter/
Host: steamcommunity.com
Run Code Online (Sandbox Code Playgroud)

它说Disallow: /actions/,这就是我收到400错误的原因吗?

Ker*_*mes 0

你用了吗setRequestHeader

xhr.open("POST", "/steamapi/actions/RemoveFriendAjax", false);
xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
Run Code Online (Sandbox Code Playgroud)