The WS API makes a strange distinction between calling withMethod(<method>)
and calling <method>()
directly. Most notably, I can only call the withBody
method after calling withMethod
.
Example:
ws .url("http://example.org/endpoint";) .withMethod("POST") .withBody(StreamedBody(source)) .execute()
ws .url("http://example.org/endpoint";) .post(File)
It took me a while to realize that the second version executes directly. However what I don't understand is that the second version cannot stream its body.
post()
, put()
and so on get renamed to executePost()
, or that they support WSBody as well.