If you are sending image content, you will need to include a Content-Type header:
You can remove the Accept header, unless you are expecting image content to be returned.
Ron McLeod wrote:If you are sending image content, you will need to include a Content-Type header:
You can remove the Accept header, unless you are expecting image content to be returned.
The Accept header I have removed. and add the following into the Request.Builder()
.addHeader("Content-Type", "image/jpeg")
My code is also:
I get also the following error:
I hope you or someone else has another idea why it don't work.
Unlikely that this will resolve the problem, but maybe the message Unsupported Media Type - All provided media types are unsupported is meant to tell you that the type of content you will accept is not supported?
Try adding-back the Accept header, but with a wildcard MIME type:
Ron McLeod wrote:Unlikely that this will resolve the problem, but maybe the message Unsupported Media Type - All provided media types are unsupported is meant to tell you that the type of content you will accept is not supported?
Try adding-back the Accept header, but with a wildcard MIME type:
After add of addHeader("Accept", "*/*") I get a the following different error:
If I use the following curl command it works (it doesn't work with okhttp3) - what is wrong:
What is the code equivalent in okhttp3 for the above curl example?
We don't have time to be charming! Quick, read this tiny ad:
Free, earth friendly heat - from the CodeRanch trailboss