mna/upstashdis

[BUG] Decoding non-encoded base64 value

Opened this issue · 1 comments

First of all: Great library!

I ran into a small issue when I tried to setup the server locally.
Per default @upstash/redis is using the Upstash-Encoding header and therefore expects the returned result value(s) to be already base64-encoded (and hence tries to decode them again)
Trying to decode a non-base64-encoded value obviously leads to an error in general.

A possible solution would be to encode the result if the Upstash-Encoding header is set. That way, testing manually via an HTTP client would still return human-readable values.

mna commented

Hello,

Thanks for the kind words!

A possible solution would be to encode the result if the Upstash-Encoding header is set. That way, testing manually via an HTTP client would still return human-readable values.

That makes sense to me. I don't use the @upstash/redis javascript client, I wasn't aware of this Upstash-Encoding header support. Happy to help review and merge a PR that would add this feature!

Martin