Consider the following code:
OkHttpClient client = new OkHttpClient();
MediaType mediaType = MediaType.parse(\"text/plain; charset=utf-8\"); // [A]
I found the solution:
The following line is the culprit:
RequestBody body = RequestBody.create(mediaType, media);
create has 3 signatures for media:
When I pass a String, it disregards the supplied mediaType and adds the charset to it. Even for image/jpeg it would send
image/jpeg; charset=utf-8
to the server.
Using byte[] or File suppresses that behavior.
I hope this helps you!
[Stupid me - for simplicity I gave it a String during testing, as I didn't care about the body ;-( ]