Fixed logging incorrectly attempting to read header from parsed_response

Added test. Fixes #299.