https://kotlinlang.org logo
#chucker
Title
# chucker
c

Colton Idle

07/16/2020, 4:56 AM
I'm converting an old app of mine from Chuck to Chucker. For some reason in Chucker 3.2.0 the response sizes all say -1B. This wasn't happening in chuck. I did a quick search on github and didn't find anything. Anyone have any ideas?
g

gammax

07/16/2020, 8:32 AM
This should be relevant for you: https://github.com/ChuckerTeam/chucker/pull/234 tl;dr: if you see
-1
it means that the
contentLength
is not returned by OkHTTP.
c

Colton Idle

07/16/2020, 3:27 PM
@gammax thanks for the response. As someone that's not all that familiar with contentLength... is this a header that my backend should be returning back to me?
g

gammax

07/16/2020, 3:28 PM
c

Colton Idle

07/16/2020, 3:29 PM
Hm. Okay. Definitely have some digging to do. The header sent from the API is out of my control... but having the sizes there is helpful. I'm checking Charles Proxy and I can see that the header is missing, but Charles does show the size.
g

gammax

07/16/2020, 3:30 PM
yeah we discuss a bit about that. We decided to keep the
contentLength
consistent with what OkHTTP was returning to us.
c

Colton Idle

07/16/2020, 3:31 PM
Makes sense. I guess it would be nice to be able to configure this though. It's been super nice with Charles + Chuck to be able to take a quick glance and see that "Oh hey, this one payload is 2MB!!!" but now that I upgraded to chucker on this one project, we lost that.
Especially since Charles shows the size... I think it would be nice to be able to opt in. Just my 2 cents.
👍 1
Let me know if you think I should file a feature request or something.
@gammax when you said "Correct" and linked the rfc. The rfc doesn't actually recommend it anywhere right? Or am I missing something? 👀
g

gammax

08/14/2020, 6:45 PM
The RFC is actually “suggesting” it:
Copy code
Aside from the cases defined above, in the absence of
   Transfer-Encoding, an origin server SHOULD send a Content-Length
   header field when the payload body size is known prior to sending the
   complete header section.  This will allow downstream recipients to
   measure transfer progress, know when a received message is complete,
   and potentially reuse the connection for additional requests.
👍 1
2 Views