Skip to content

Support extra_headers for WS accept message#1293

Merged
Kludex merged 3 commits intoKludex:masterfrom
matiuszka:ws-extra-headers
Jan 6, 2022
Merged

Support extra_headers for WS accept message#1293
Kludex merged 3 commits intoKludex:masterfrom
matiuszka:ws-extra-headers

Conversation

@matiuszka
Copy link
Copy Markdown
Contributor

The extra_headers support for WS accept message.
According to ASGI spec: https://asgi.readthedocs.io/en/latest/specs/www.html#accept-send-event

@matiuszka
Copy link
Copy Markdown
Contributor Author

I need to fix the pipeline.

Comment thread uvicorn/protocols/websockets/websockets_impl.py Outdated
Comment thread uvicorn/protocols/websockets/websockets_impl.py
@Kludex
Copy link
Copy Markdown
Owner

Kludex commented Dec 15, 2021

Thanks for the PR @matiuszka ! 🎉

Copy link
Copy Markdown
Owner

@Kludex Kludex left a comment

Choose a reason for hiding this comment

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

Thanks @matiuszka ! :)

Let's wait for Kludex/starlette#1361 to be fixed, and then we can merge this one :)

NOTE: Starlette PR is actually not a requisite to have this merged, but I'd like to merge them together 🙏

@Kludex Kludex merged commit 867de39 into Kludex:master Jan 6, 2022
# ASGI spec requires bytes
# But for compability we need to convert it to strings
(name.decode("latin-1"), value.decode("latin-1"))
for name, value in message.get("headers")
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

just small syntax comment:
for name, value in message["headers"]
due to already checking if "headers" in message

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

true, PR welcome :P

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@t1waz are you going to open PR for that? I can do that also.

Kludex added a commit to sephioh/uvicorn that referenced this pull request Oct 29, 2022
* Support `extra_headers` for WS `accept` message

* Update uvicorn/protocols/websockets/websockets_impl.py

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>

Co-authored-by: Marcelo Trylesinski <marcelotryle@gmail.com>
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.

3 participants