http_client client(L"http://127.0.0.1:9060/");
/*******************************
http_response response = client.request(methods::POST, builder.to_string(),postData).get();
我想設定傳遞頭
client.add_handler();
傳遞
<header>Accept:application/json</header>
<header>Content-Type:application/json;charset=UTF-8</header>
但是不知道
Accept:application/json如何加入進去..
cpprestsdkv141
2.10.12.1
看了微軟的檔案較老無法用了...
求教添加~
uj5u.com熱心網友回復:
設定頭資訊 在這個檔案里cpprestsdk/Release/include/cpprest/http_client.h如果你想要設定成json的格式,我的做法是這樣的:
web::uri uri(U("http://localhost:80/client"));
web::http::client::http_client client(uri);
web::http::http_request request2(methods::POST);
request2.set_request_uri(uri);
request2.set_body(str,"text/json");
希望能幫到你
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/25868.html
標籤:網絡及通訊開發
上一篇:python
下一篇:C+求長方體體積
