harviewer icon indicating copy to clipboard operation
harviewer copied to clipboard

Invalid `response.bodySize` in softwareishard.com.har sample HAR

Open gitgrimbo opened this issue 7 years ago • 0 comments

TL;DR - Probably should replace this (and possibly other) invalid sample HARs with spec-compliant ones.


https://github.com/janodvarko/harviewer/blob/aa648ee1bcc38dac6f0c66a80c1f026afe0edb77/webapp/examples/softwareishard.com.har#L2715..L2773

response.status=304, response.bodySize=7676

Spec says [1] the response.bodySize should be 0. Because of this, it would be impossible to determine if there actually was 0 bytes of message payload for this response, or if the HTTP server erroneously sent a message payload with a HTTP 304 response [2].

  • [1] http://www.softwareishard.com/blog/har-12-spec/#response

bodySize [number] - Size of the received response body in bytes. Set to zero in case of responses coming from the cache (304). Set to -1 if the info is not available.

  • [2] https://httpstatuses.com/304

A 304 response cannot contain a message-body; it is always terminated by the first empty line after the header fields.

gitgrimbo avatar Oct 23 '18 08:10 gitgrimbo