Type/to search
Built-in Functions
Structures
Trade
Ticker
Record
Order
Condition
OrderBook
Depth
Account
Asset
Position
Market
Funding
OtherStruct
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Chart-options
KLineChart-options
SetData-data
EventLoop-return
DBExec-return
Thread.join-return
Built-in Variables

This JSON structure is used to configure various parameters for HTTP requests sent by HttpQuery and HttpQuery_Go functions.

Attributes

NameTypeDescription

method

string

HTTP request method, for example: GET, POST, etc.

body

string

Request body content. For example, in POST requests, body can contain form data, JSON data, text, etc.

charset

string

Character set encoding. Used to specify the encoding method for text data in the request body, for example: "UTF-8".

cookie

string

Cookie is a small piece of data used to store and exchange state information between the client (usually a browser) and the server.

debug

bool

Debug mode switch. When set to true, the HttpQuery function call will return the complete HTTP response message; when set to false, it only returns the data in the response message Body.

headers

JSON

HTTP request header information, existing as key-value pairs (JSON structure), used to pass various information such as content type, authentication information, cache control, etc.

timeout

number

Timeout setting in milliseconds. Setting 1000 means 1 second timeout.

See Also

Remarks

Usage example:

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

HTTP message sent when the above code is executed:

log
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