Im finishing this project which is using okhttp for communication with a webservice.
All is going fine for regular GETs and POSTs, but I\'m not being able to properl
I found answer to my own question a bit after initial post.
I´ll leave it here, because it can be useful to others, given that there is such a few okhttp upload examples around:
RequestBody requestBody = new MultipartBuilder().type(MultipartBuilder.FORM)
.addFormDataPart("group", getGroup())
.addFormDataPart("type", getType())
.addFormDataPart("entity", Integer.toString(getEntity()))
.addFormDataPart("reference", Integer.toString(getReference()))
.addFormDataPart("task_file", "file.png", RequestBody.create(MediaType.parse("image/png"), getFile()))
.build();
There is no reason to use "addPart" with "Headers.of" etc like in the recipes, addFormDataPart does the trick.
And for the file field itself, it takes 3 arguments: name, filename and then the file body. That's it.