Home > Back-end >  REST the SDK client response how to set up a head?
REST the SDK client response how to set up a head?

Time:11-08

Http_client client (L "http://127.0.0.1:9060/");
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
Http_response response=client request (the methods: : POST, builder. To_string (), postData). The get ();
I want to set the transfer head
Client. Add_handler ();
Transfer
Accept: application/json

The content-type: application/json; Charset=utf-8 & lt;/header>
But don't know
Accept: application/json how to join in..
Cpprestsdkv141
2.10.12.1
Read the older can't use Microsoft document...
Refer to add ~

CodePudding user response:

Set the header information in the file cpprestsdk/Release/include/cpprest/http_client h
If you want to set to json format, my way is like this:
Web: : uri uri (U (" http://localhost:80/client "));
Web: HTTP: : client: : http_client client (uri).

Web: HTTP: : http_request request2 (the methods: POST);
Request2. Set_request_uri (uri);
Request2. Set_body (STR, "text/json");
The hope can help you
  • Related