Skip to content

Convert CaseInsensitiveDict response headers to dict#396

Closed
Tenzer wants to merge 1 commit intoDataDog:masterfrom
Tenzer:dict-response_headers
Closed

Convert CaseInsensitiveDict response headers to dict#396
Tenzer wants to merge 1 commit intoDataDog:masterfrom
Tenzer:dict-response_headers

Conversation

@Tenzer
Copy link
Copy Markdown
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
Copy Markdown
Contributor Author

Tenzer commented Jun 10, 2019

Rebased on the latest master branch.

@agottlie
Copy link
Copy Markdown

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
Copy Markdown
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