I made a request to the server and would like to get a response. Thanks for the correction. But the result of the answer is still null. Please tell me why this

get sesion paste g_sessionID

globalThis.httpPostErrorPause = async function() {
    let httpPostRequest = new Promise(function (resolve, reject) {
        var xhrCancelBuyOrder = new XMLHttpRequest();
        var url = "https://steamcommunity.com/market/createbuyorder/";
        var params = `sessionid=031ce07a1fb035b43609dd6b&currency=1&appid=753&market_hash_name=326670-Elf Waywatcher (Foil)&price_total=${Math.round(0.03 * 100 * 2)}&quantity=2&billing_state=&save_my_address=0`;
        xhrCancelBuyOrder.open('POST', url, true);
        xhrCancelBuyOrder.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
        xhrCancelBuyOrder.onreadystatechange = function () {
            if(xhrCancelBuyOrder.readyState == 4 && xhrCancelBuyOrder.status == 200) {
                console.log(xhrCancelBuyOrder.responseText);
                return resolve(xhrCancelBuyOrder.responseText);
            } 
        };
        xhrCancelBuyOrder.onerror = function () {
            reject(new Error("Network Error"));
        };
        xhrCancelBuyOrder.send(params);
    });
};
globalThis.httpPostErrorPause();

I am not sure if this is the only problem, but if you do not await the async function call, it will always be null.

I’d test with this:

//globalThis.httpPostErrorPause();
const call =  await globalThis.httpPostErrorPause();
console.log(call)

Thanks for answering