Jsoup - Raw Body Transfer for POST

I need to pass the raw body into a POST request using Jsoup:

final Connection connect = Jsoup.connect(url);

connect.method(Connection.Method.POST);

String rawBody = // a JSON string representing JSON-RPC call

// fails here "Must supply an even number of key value pairs"
connect.data(rawBody); 

final Connection.Response response = connect.execute();

As I understand it, it expects a key, value pair. Is there a way to convey a raw body?

PS I already have code that creates HTTP messages through HttpURLConnectionand you need to switch to using Jsoup instead of a relatively low-level code for this.

+3
source share
1 answer

It doesn't seem like it's possible. Connection data # is used to pass parameters to the request, and parameters fall in pairs.

+1
source

All Articles