资源加载中... loading...

HttpQuery-options

This JSON structure is used to configure the parameters of the HttpQuery function and the HttpQuery_Go function to send the Http request.

Request method, for example: GET, POST, etc. method string Request body. For example, in a POST request, the body can contain form data, JSON, text, etc. body string Character set encoding. For example, specify the encoding of text data in the body as: "UTF-8". charset string A cookie is a small piece of data used to store and exchange state information between a client (usually a browser) and a server. cookie string Used to simulate browser tls fingerprint. profile string When set to true, the HttpQuery function call returns the complete response message. When set to false, only the data in the response message Body is returned. debug bool Request header information exists in the form of key-value pairs (JSON structure) and is used to transmit various information, such as content type, authentication information, cache control, etc. headers JSON Timeout setting. Setting 1000 means a timeout of 1 second. timeout number

Example of use:

function main() {
    var options = {
        method: "POST",
        body: "a=10&b=20&c=30",
        charset: "UTF-8",
        cookie: "session_id=12345; lang=en",
        profile: "chrome_103",
        debug: false,
        headers: {"TEST-HTTP-QUERY": "123"},
        timeout: 1000
    }
    var ret = HttpQuery("http://127.0.0.1:8080", options)
    Log(ret)
}

The http message sent when the above code is executed:

POST / HTTP/1.1
Content-Type: application/x-www-form-urlencoded
Cookie: session_id=12345; lang=en
Host: 127.0.0.1:8080
Test-Http-Query: 123
Transfer-Encoding: chunked
User-Agent: Mozilla/5.0 (Macintosh; ...
Accept-Encoding: gzip, deflate, br

e
a=10&b=20&c=30
0

{@fun/Global/HttpQuery HttpQuery}, {@fun/Global/HttpQuery_Go HttpQuery_Go}

Funding HttpQuery-return