Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Edit SimpleHttpClient to reference that header keys can be passed as str or bytes #6077

Merged
merged 5 commits into from
Sep 27, 2019

Conversation

anoadragon453
Copy link
Member

@anoadragon453 anoadragon453 commented Sep 20, 2019

Header dicts should have bytes as the key in the headers dict, not a str.

@anoadragon453 anoadragon453 self-assigned this Sep 20, 2019
@anoadragon453 anoadragon453 requested a review from a team September 20, 2019 16:46
@@ -0,0 +1 @@
Ensure header dicts passed to SimpleHttpClient using `bytes` instead of `str` for keys.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should match the PR which introduced the bug (#5976)

Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure what this is for. AFAIK the SimpleHttpClient methods accept either str or bytes for both the header name and the values

Certainly the docstring isn't clear about this, and I wouldn't be hugely averse to us doing a bit of a cleanup on it - but (a) it seems odd to change the header name and not the value, and (b) just changing one header name instance doesn't seem to achieve much.

@anoadragon453 anoadragon453 changed the title Ensure headers passed to SimpleHttpClient are bytes Edit SimpleHttpClient to reference that header keys can be passed as str or bytes Sep 26, 2019
@anoadragon453
Copy link
Member Author

I've updated the PR to only edit the docstrings now, as I think that would've saved me from this confusion.

synapse/http/client.py Outdated Show resolved Hide resolved
changelog.d/6077.bugfix Outdated Show resolved Hide resolved
synapse/handlers/room_member.py Outdated Show resolved Hide resolved
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@anoadragon453 anoadragon453 merged commit f345111 into develop Sep 27, 2019
@anoadragon453 anoadragon453 deleted the anoa/make_headers_bytes branch September 27, 2019 16:59
babolivier pushed a commit that referenced this pull request Sep 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants