okhttp icon indicating copy to clipboard operation
okhttp copied to clipboard

Support sending request trailers

Open aajtodd opened this issue 3 years ago • 4 comments

Add support for sending trailing headers (rfc7230-4.1/4.4) in a request.

Currently trailers are supported for Response objects but there is no way to set trailers on a request.

aajtodd avatar Oct 31 '22 17:10 aajtodd

Request is reusable in OkHttp. So Call.setRequestTrailers(Headers)?

yschimke avatar Nov 04 '22 10:11 yschimke

Seems like the point of trailers is for things discovered while sending the request. Otherwise they would just be normal headers. So it's probably something like a callback that's invoked after the entire body has been written to produce them.

JakeWharton avatar Nov 04 '22 12:11 JakeWharton

Presumably useful to sign or checksum the request body?

swankjesse avatar Dec 24 '22 14:12 swankjesse

Yeah the primary motivation I'm aware of is checksums. This ended up not being necessary for us (we do chunked encoding with ability to checksum without trailer support). It would still be good feature for completeness sake.

aajtodd avatar Dec 24 '22 19:12 aajtodd