Quantcast
Channel: Active questions tagged rest - Stack Overflow
Viewing all articles
Browse latest Browse all 3820

How set the body of request with QNetworkRequest

$
0
0

I currently post to a ReST server in Qt6 like this:

QNetworkRequest request;request.setUrl(QUrl("someurl"));QUrlQuery postData;postData.addQueryItem("somekey","somevalue");nm = new QNetworkAccessManagerreply = nm->post(request,postData.toString(QUrl::FullyEncoded).toUtf8());

However, I am told that I need to send some JSON in the body of the request. Where do I set the body of the post? The second parameter of the ->post method is the query parameters.

I'm guessing I need to combine the body (json document) with the postData but I'm not sure how.


Viewing all articles
Browse latest Browse all 3820

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>