java - Okhttp - Multipart - how to disable Content-Length for a part? -


okhttp automatically adds content-length header each part in request build multipartbody.builder. need remove header, because api i'm using not allow (and can't it).

i've tried add interceptor request (both addinterceptor , addnetworkinterceptor) in order remove unwanted header. not there (i can see content-disposition). i've debugged source code , turns out content-length being added after interception event.

do have idea how fix this? thing comes mind build request manually. have write interceptor adds multipart header request , generates request body based on provided parts (with boundary, byte stream etc.).

edit:

workaround: https://github.com/square/okhttp/issues/2604