Nodejs https post submission Tip: TLSSocket.onHangUp

for example, this code:


    async https_post(){

        let url = "https://www.4tuu.com/";

        const request = require("request");

        let post_data = {
            action:"api_info",
        }

        let request_ops = {
            url: url,
            timeout:10000,
            headers: {

            },
        };


        request_ops = Object.assign({}, request_ops, {
            form:post_data,
            method: "POST",
            json: false,
            agentOptions: {
            },

        });


        request(request_ops, async function (err,  res, aa){

            console.log("err,  res, aa", err,  res, aa);

        });

    }

specific hint:


{ Error: socket hang up
    at TLSSocket.onHangUp (_tls_wrap.js:1137:19)
    at Object.onceWrapper (events.js:313:30)
    at emitNone (events.js:111:20)
    at TLSSocket.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
  code: "ECONNRESET",
  path: null,
  host: "www.4tuu.com",
  port: 443,
  localAddress: undefined }

tried a lot of methods, but they didn"t work. You can try.
but I can submit it using some online post submission tools. Nodejs can"t. I don"t know why.

Apr.25,2022
Menu