Guest Sampli Posted May 4, 2020 Report Posted May 4, 2020 function sellItem(item, price, sessionID, callback) { var options = { url: 'https://steamcommunity.com/market/sellitem/', headers: { 'Accept': '*/*', 'Origin': 'http://steamcommunity.com', 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36 OPR/67.0.3575.130', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', 'Host': 'steamcommunity.com', 'Origin': 'https://steamcommunity.com', 'Referer': 'http://steamcommunity.com/profiles/'+client.steamID.getSteamID64()+'/inventory/', 'Accept-Encoding': 'gzip, deflate, br', 'Accept-Language': 'en-US,en;q=0.9', 'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8' }, form: { sessionid: sessionID, appid: item.appid, contextid: item.contextid, assetid: item.assetid, amount: 1, price: 1 } }; request(options, function (error, response, body) { if(!error && response.statusCode == 200){ console.log("Item added on market"); }else{ console.log(error); console.log(body); console.log(response); console.log(response.statusCode); } }); } This is my post request, which throws a http error 400 (bad request) every time. I don't know what i'm doing wrong. Quote
Guest Sampli Posted May 4, 2020 Report Posted May 4, 2020 28 minutes ago, vrtgn said: Are you passing/setting cookies? No, but I'm getting cookies generated by steam in my response. Quote
Guest Sampli Posted May 4, 2020 Report Posted May 4, 2020 13 minutes ago, vrtgn said: Try changing the referer to https. Didn't do anything, sorry. I ended up figuring it out using the request method. Quote
Guest Sampli Posted May 4, 2020 Report Posted May 4, 2020 Just now, vrtgn said: Was it because you weren't posting? I have no idea... but it works so i'm not complaining Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.