Type/to search
Built-in Functions
Structures
Ticker
Depth
OrderBook
Trade
Record
Market
Order
Condition
Account
Asset
Position
Funding
Other Structures
HttpQuery-options
HttpQuery-return
LogStatus-table
LogStatus-btnTypeOne
LogStatus-btnTypeTwo
Status Bar Components
Chart-options
Chart-return
KLineChart-options
KLineChart-return
SetData-data
EventLoop-return
exchange.Go-return
DBExec-return
Dial-return
Thread.join-return
Built-in Variables and Constants
Conventions
Exchanges

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 of the response. When set, the response body is decoded from this character set into UTF-8 text, for example GBK for a GBK-encoded web page. Length in the returned structure is still the length before decoding; an unrecognized character set logs an error and leaves the body unchanged. This option has nothing to do with the encoding of the request body.

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

object

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.

proxy

string

Proxy for this request. Supports http://, https://, socks5:// and socks5h://, for example: "socks5://user:[email protected]:1080". It applies only to this request and is independent of the exchange proxy set by exchange.SetProxy().

timeout

number

Timeout setting in milliseconds. Setting 1000 means 1 second timeout. Defaults to 300000 (5 minutes) when not set.

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 Content-Length: 14 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) ... Accept-Encoding: gzip, br a=10&b=20&c=30