-
-
Notifications
You must be signed in to change notification settings - Fork 101
fix: prefix not getting replaced in certain cases #155
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
Conversation
Can you please add a unit test? |
To be honest, I'm not sure what to even test for. It seems to work with |
What was the bug? Have you got a reproduction that you used to check if this fixed your problem? Port that to be a unit test. |
The bug was that the prefix was not getting replaced before the request is forwarded to upstream. I have been using this library without issue in another project, but a new one that I just created following the example in the README wasn't working. I'll take a closer look to see if there are any differences, but the implementation in the units tests look to be the same as the one I am using. |
There is likely some difference ;). |
Okay, it seems that my TypeScript watcher stopped working so I was running an older version during my testing. The issue is caused by the fastify-websocket library. It hijacks the handlers and binds the internal fastify server object instead of the public API. Let me know how you'd like me to proceed with this, since I don't think this is normal behaviour and you may not want to deal with it, but I am happy to write a test if you'd like to incorporate this change. |
Does the fix resolve your problem then? |
Yes, the proposed changes fixes it. |
Then add an automated test that failed before the change. |
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.
Now that I see the test, I'm starting to think I might be wrong and the bug might actually be in fastify-websocket.
What do you think?
Yeah, that's what I'm thinking, so I'm not too sure what you want to do with it. The change does fix the problem and it seems there is already use of |
Take a look at fastify/fastify-websocket#122, I think it's the correct fix. |
Fixes #152
Checklist
npm run test
andnpm run benchmark
and the Code of conduct