Fixed logging attempting to read header from parsed_response.

Added test. Fixes #299.