I'm trying to send a post request like this:
(我正在尝试发送这样的发帖请求:)
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);
I'm using an Apache Server, and this is my .htaccess
file
(我正在使用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>
Whenever I send the request I get this error:
(每当我发送请求时,都会出现此错误:)
Failed to load resource: the server responded with a status of 400 (Bad Request)
enter code here
Why is this happening?
(为什么会这样呢?)
I have used GET requests with Steam and they work fine, put this POST request doesn't seem to be working.(我已经将GET请求与Steam一起使用,并且它们可以正常工作,但此POST请求似乎不起作用。)
EDIT: This is steamcommunity.com's
robot.txt
file:
(编辑:这是steamcommunity.com's
robot.txt
文件:)
User-agent: *
Disallow: /actions/
Disallow: /linkfilter/
Host: steamcommunity.com
It says Disallow: /actions/
, so is this the reason why I'm getting a 400
error?
(它说Disallow: /actions/
,这就是我收到400
错误的原因吗?)
ask by Varun Iyer translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…