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

Vite middleware's 'originalUrl' and 'Request' object. #324

Open
benoitlahoz opened this issue Nov 28, 2024 · 2 comments
Open

Vite middleware's 'originalUrl' and 'Request' object. #324

benoitlahoz opened this issue Nov 28, 2024 · 2 comments

Comments

@benoitlahoz
Copy link

benoitlahoz commented Nov 28, 2024

Hello and thank you for this work!

As quoted in this issue vite development server writes to the originalUrl property of Request which doesn't work with HyperExpress.

I guess at least at these lines in vite:

The error is TypeError: Cannot set property originalUrl of #<Request> which has only a getter.

@DadiBit, the author of the issue, suggests that it is possible to extend Request to add the possibility for vite to change the property.

As I'm writing an adapter that would allow users to switch between Express and HyperExpress, my question is: how would one extend this class and 'inject' it in the HyperExpress process?

Any tip would be greatly appreciated.
Thank you.

@kartikk221
Copy link
Owner

Seems like we would need a setter here which can act as a setter on the internal url cache property.

Do you think you could make a PR which would add support for this?

@benoitlahoz
Copy link
Author

Thank you for your answer.
You can find an example for this PR here.

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

2 participants