-
Notifications
You must be signed in to change notification settings - Fork 736
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
websocket support in dev
#150
Conversation
This resuscitates threepointone/nu-wrangler#19 via @Electroid. This probably needs tests, in a future PR. But it works well!
🦋 Changeset detectedLatest commit: ef64b87 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Great, thanks @threepointone and @Electroid! I'll look at working out how to incorporate this into |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WebSockets - FTW!
NIT: I think we could make proxy.ts a bit more maintainable by splitting up the bulk of the code into a few more named functions.
.changeset/fuzzy-dancers-nail.md
Outdated
"wrangler": patch | ||
--- | ||
|
||
Websocket support in `dev` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be great if we could get a bit more content into these changesets. 🙏
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done!
headers[name] = value | ||
.replaceAll(`https://${host}`, `http://localhost:${port}`) | ||
.replaceAll(host, `localhost:${port}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it OK to mutate the headers object like this?
Would be safer to design this so that the onResponse(headers)
returns a new headers object with the appropriate changes?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be okay. But both onResponse
and onRequest
could be redesigned to require a return, instead of mutating.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
happy to revisit this in a future PR, might be a little more involved than just the return from the handler
This resuscitates https://github.com/threepointone/nu-wrangler/pull/19 via @Electroid. This probably needs tests, in a future PR. But it works well!