fix: getServerToken returns null when used in middleware
๐ Linked issue
#139
โ Type of change
- [ ] ๐ Documentation (updates to the documentation, readme or JSdoc annotations)
- [x] ๐ Bug fix (a non-breaking change that fixes an issue)
- [ ] ๐ Enhancement (improving an existing functionality like performance)
- [ ] โจ New feature (a non-breaking change that adds functionality)
- [ ] ๐งน Chore (updates to the build process or auxiliary tools and libraries)
- [ ] โ ๏ธ Breaking change (fix or feature that would cause existing functionality to change)
๐ Description
When using getServerToken in a middleware the function returns null because it can't read the cookies.
I changed your cookie parsing from the headers to using the h3 function parseCookies
Resolves #139
๐ Checklist
- [x] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
Was there a reason you parsed the cookies yourself instead of using the h3 parseCookies function?
Was there a reason you parsed the cookies yourself instead of using the h3
parseCookiesfunction?
It wasn't implemented properly in h3 when I created the module, but pretty sure it got fixed now.
The fix look good, but I need to find the time to test it as we don't have good test coverage set-up.
I would like to add that this does not solve getServerToken returning null on the server. Is there a workaround for getting the user's id?
@ferat Could you give #167 a try ? I believe this will resolve the issue and we'll close this PR.