Bellow i have some code, i took the FormData: from your steamcommunity files and just changed the values to match mine. the headers are then the same as any other request i send to steam with the cookies of course taken directly from the browser (i copied and pasted the stesssionid to the formdata: one ) however i get a 302 im not sure why can you help?
var cookie = "//cookies pasted from browser"
var buffer = fs.readFileSync("./pfps/[object Object].jpg",{encoding:"base64"})
console.log(buffer)
request({
url:"https://steamcommunity.com/actionFileUploaders/",
method:"POST",
headers:{
'Connection': 'keep-alive',
'Accept': 'application/json, text/plain,*/*',
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/81.0.4044.129 Safari/537.36',
"Accept-Encoding":"gzip, deflate, br",
//'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8', changed for miltipart formdata
'Origin': 'https://steamcommunity.com',
'Sec-Fetch-Site': 'same-origin',
'Sec-Fetch-Mode': 'cors',
'Sec-Fetch-Dest': 'empty',
'Accept-Language': 'en-GB,en-US;q=0.9,en;q=0.8',
"Content-Type":"multipart/form-data;",
"Referer":`https://steamcommunity.com/profiles/id64/edit/avatar`,
"Content-Length":buffer.length,
'Cookie': cookie
},
formData: {
"MAX_FILE_SIZE": buffer.length,
"type": "player_avatar_image",
"sId": `id64`,
"sessionid": `sID`,
"doSub": 1,
"json": 1,
"avatar": {
"value": buffer,
"options": {
"filename": "avatar.jpg",
"contentType": "image/jpeg"
}
}
},
},function callback(error,response, body) {
console.log(response.statusCode,body,);
//console.log(body);
})