Reputation: 418
I don't see any way to get that header in akk-http. That header is removed from header list in HttpResponse.
I know there are methods that return the contentLength from entity:
HttpEntity.contentLengthOption
and
HttpEntity.contentLength
on strict entity.
But that both calls are based on entity itself, and that's not what I want.
In my case I'm sending the Head
request to server(riak) to check if the object has proper size. I don't want to get the whole object using Get
. That should be just a test.
That's how the response looks like:
curl -I "http://req-to-riak"
HTTP/1.1 200 OK
X-Riak-Vclock: a85hYGBgzGDKBVI82eqS92f/Ot/EwOT3PoMpkTGPleHKa8WLfFkA
Vary: Accept-Encoding
Server: MochiWeb/1.1 WebMachine/1.10.8 (that head fake, tho)
Last-Modified: Fri, 12 Aug 2016 06:42:28 GMT
ETag: "5IVrr7tsZp1O4FHLnMSc30"
Date: Wed, 24 Aug 2016 12:53:32 GMT
Content-Type: image/gif
Content-Length: 290305
But akka still return 0
Upvotes: 0
Views: 1026
Reputation: 221
It's a bug of Akka-Http, see here: https://github.com/akka/akka-http/issues/377
Upvotes: 1