fix: encode buffer responses from cached event handler
๐ Linked issue
https://github.com/unjs/nitro/issues/1894
โ 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
Caching an endpoint that returns a buffer will break the endpoint. As an easy fix, we just base 64 encode whatever the result is and mark it as so.
๐ Checklist
- [x] I have linked an issue or discussion.
- [ ] I have updated the documentation accordingly.
As of discussion in #1894, I think we might use raw methods of unstorage (behind a flag) also unstorage should automatically handle base64 transformation for drivers not supporting natively binary data if it does not it is something to fix there.
As of discussion in #1894, I think we might use raw methods of unstorage (behind a flag) also unstorage should automatically handle base64 transformation for drivers not supporting natively binary data if it does not it is something to fix there.
I agree, that seems like quite a bit of work though and I don't think I have enough context to attempt it.
Perhaps we can merge this as a temporary fix until that's ready? Not sure what else I can do to unblock myself with this bug.
(was hoping to rebase with latest undio version to support at least all h3 binary types including streams. might delay to prioritize other reactors sorry for this delay it is an important issue)