Skip to content

How to do httpclient post right ?! #440

@Hedgezzz

Description

@Hedgezzz

I have the following code ::

string req="https://testnet.binancefuture.com/fapi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=21002.2&recvWindow=60000&timestamp=1676439415772&signature=28ba85cfdb2b44cf12d89281c6ef7704a4211224b6b92c81763ec394b2e8db87" ;

HttpClient httpClient;
HttpRequestArgsPtr args = httpClient.createRequest();
WebSocketHttpHeaders headers;
headers["X-MBX-APIKEY"] = "XXXXXXXXXXXXXXXXXXXXX";
args->extraHeaders = headers;

    HttpResponsePtr response;
    std::string ixurl = "https://testnet.binancefuture.com"; 
    response = httpClient.request(ixurl, "POST",req, args,0);
    auto body = response->body;
    cout << body << endl ;

this source would core dump , what should I do to make this work ?!

BTW , the following works in curl ::

curl -H "X-MBX-APIKEY: XXXXXXXXXXXXXXXXXXXXX" -X POST "https://testnet.binancefuture.com/fapi/v1/order?symbol=BTCUSDT&side=BUY&type=LIMIT&timeInForce=GTC&quantity=1&price=21002.2&recvWindow=60000&timestamp=1676439415772&signature=28ba85cfdb2b44cf12d89281c6ef7704a4211224b6b92c81763ec394b2e8db87"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions