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

Should frameworks change scope values? #343

Open
pgjones opened this issue Sep 4, 2022 · 4 comments
Open

Should frameworks change scope values? #343

pgjones opened this issue Sep 4, 2022 · 4 comments

Comments

@pgjones
Copy link
Contributor

pgjones commented Sep 4, 2022

See pgjones/hypercorn#75 where Starlette changes the scope["path"], should ASGI frameworks do this or consider the existing values immutable? (I don't think the specification says - I may work around by passing a copy to the framework)

@Kludex
Copy link
Contributor

Kludex commented Sep 4, 2022

Maybe relevant: encode/starlette#1336.

@andrewgodwin
Copy link
Member

andrewgodwin commented Sep 4, 2022

Yeah, you're not really meant to change the value of path, I feel - since it's meant to always have root_path at the start. I'm not going to go all out and say something absolutely shouldn't, but I think if it's modified then root_path has to be included in that to make things make sense.

@Kludex
Copy link
Contributor

Kludex commented Sep 11, 2022

We'll fix Starlette. It's not Hypercorn's fault. Uvicorn has the same behavior as Hypercorn. 🙏

@adriangb
Copy link
Contributor

adriangb commented Nov 9, 2022

Related: Starlette at least mutates scope even when the spec clearly states "when middleware is modifying the scope, it should make a copy of the scope object before mutating it and passing it to the inner application" 🤷🏻‍♂️

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

No branches or pull requests

4 participants