Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert CaseInsensitiveDict response headers to dict #396

Closed
wants to merge 1 commit into from
Closed

Convert CaseInsensitiveDict response headers to dict #396

wants to merge 1 commit into from

Conversation

Tenzer
Copy link
Contributor

@Tenzer Tenzer commented Jun 10, 2019

Requests by default makes the response headers into it's own custom type,
CaseInsensitiveDict, which can't be JSON serialized without extra work.
This affects the dog timeboard show ... and dog screenboard show ...
commands, as they JSON encode the Python data structures and they will give
the following error message without this change:

TypeError: Object of type CaseInsensitiveDict is not JSON serializable

This fixes it by explictly converting the response headers object to a dict
before being added to the response object.

Requests by default makes the response headers into it's own custom type,
`CaseInsensitiveDict`, which can't be JSON serialized without extra work.
This affects the `dog timeboard show ...` and `dog screenboard show ...`
commands, as they JSON encode the Python data structures and they will give
the following error message without this change:

    TypeError: Object of type CaseInsensitiveDict is not JSON serializable

This fixes it by explictly converting the response headers object to a dict
before being added to the response object.
@Tenzer
Copy link
Contributor Author

Tenzer commented Jun 10, 2019

Rebased on the latest master branch.

@agottlie
Copy link

Hey @Tenzer looks like this PR that was just merged should resolve this issue: #397 - can you take a look and see if that does the trick?

@Tenzer
Copy link
Contributor Author

Tenzer commented Jun 11, 2019

I can see this PR is no longer necessary as the addition of the response headers to the response object was reverted again in dac5c40.

@Tenzer Tenzer closed this Jun 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants