Hi!
I noticed that responses with Content-Length = 0 are not stored in the URLCache, while responses with Content-Length > 0 are stored.
In my case the response contains a Protobuf message where all fields might have default values. This message will have size 0 when encoded and is a valid message. I would expect this message to be cached as all other instances of the message type.
Is there a reason why 0-sized response are not stored in cache? Or is it a bug?
Best Regards
Markus
Steps to reproduce:
This response will cause URLCache.storeCachedResponse(_, for) to be called:
This response will not cause any call to URLCache.storeCachedResponse(_, for):
I noticed that responses with Content-Length = 0 are not stored in the URLCache, while responses with Content-Length > 0 are stored.
In my case the response contains a Protobuf message where all fields might have default values. This message will have size 0 when encoded and is a valid message. I would expect this message to be cached as all other instances of the message type.
Is there a reason why 0-sized response are not stored in cache? Or is it a bug?
Best Regards
Markus
Steps to reproduce:
This response will cause URLCache.storeCachedResponse(_, for) to be called:
Code Block < HTTP/1.0 200 OK < Content-Type: application/protobuf < Content-Length: 1 < Cache-Control: max-age=20
This response will not cause any call to URLCache.storeCachedResponse(_, for):
Code Block < HTTP/1.0 200 OK < Content-Type: application/protobuf < Content-Length: 0 < Cache-Control: max-age=20