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
Feat: Add ability to set headers for WebSocket client #4436
Conversation
Is there a reason why this PR isn't triggering other checks? where other PR's have? I can't think what I would have missed |
I have just noticed the dev branch is tagged for V4. This PR checks for uninitialised properties of
With the |
Not certain what you mean? As far as I can see, tests have ran?
We will evaluate the situation after 3.1.1 (when we prepare for v4) Thanks for your efforts thus far. |
it was addressed by @dceejay shortly after😄 |
Thanks for this @marcus-j-davies - finally getting to reviewing this for 4.0 I'm not sure we need so many predefined headers in the list as many of them have no meaning in a WebSocket upgrade request. For example I suspect the main use-case is to be able to set the As you note, you allow the value to be pulled from Given the time passed since you worked on this, I'm happy to do some of this rework as part of the 4.0 prep - but do let me know if you want to dust it off and make some of these updates yourself. |
Hi @knolleary
Agreed!
The reason I have not allowed So IMO - please do correct me if wrong, is to reduce down the list of headers + any tweaks you feel are necessary? Tweaks such as - should we really check for an
|
There is absolutely no reason this should be a breaking change; it is adding a new feature, not changing an existing one. So the checks you have in place are entirely appropriate. If we want to allow It might be easier to just remove that option for now - nothing says we can't add more options later. |
Cool! I'll push the edits a bit later. |
For now : I have commented out some of the header list items (I couldn't find any definitive, to determine what are valid headers for an upgrade operation). I have also removed access to |
packages/node_modules/@node-red/nodes/core/network/22-websocket.html
Outdated
Show resolved
Hide resolved
Looks good - have applied one small change to use the built-in |
Proposed changes
This PR adds the ability to set Headers for the WebSocket client.
a lot of the editor code was lifted from the
HTTP Request
node, with some small differences.env
,global
or a static stringThe hint text has been updated, to state that headers are only used during the Upgrade routine, and this message has been translated accordingly.
A few checks are in place, to ensure users who have not provided a headers object in the node (i.e they are in receipt of this change without making changes) does not cause an
undefined
errorDiscussion here:
https://discourse.nodered.org/t/allow-adding-headers-to-websocket-client
Checklist
npm run test
to verify the unit tests pass