DX-3137: default responseEncoding to plain JSON by ytkimirti · Pull Request #1458 · upstash/redis-js · GitHub
Skip to content

DX-3137: default responseEncoding to plain JSON - #1458

Merged
CahidArda merged 8 commits into
mainfrom
DX-3137-plain-encoding
Oct 21, 2026
Merged

CahidArda merged 8 commits into
mainfrom
DX-3137-plain-encoding

Conversation

@ytkimirti

@ytkimirti ytkimirti commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Stops sending Upstash-Encoding: base64 by default. The server has escaped strings correctly since 2023, and base64 adds ~33% to string responses (and to AWS egress). responseEncoding: "base64" still opts back in.

Docs: upstash/docs#921

Behavior changes (new default vs old default)

Case Before (base64) After (false)
Value starting with a UTF-8 BOM BOM stripped, so "{...}" was parsed as JSON BOM kept, returned as a string
Invalid UTF-8 / binary values U+FFFD per invalid sequence (lossy) U+FFFD per invalid byte (still lossy)
Nested OK reply (Lua {redis.call("SET", ...)}) Sometimes "8" "OK"
Error replies nested in arrays (Lua pcall) Garbled Readable error text
SRH (self-hosted emulator) with binary values Works (lossy) SRH returns HTTP 500
Response size +~33% on strings Plain JSON

Static aborted signal result

abort(...) default before default after false before false after base64 before base64 after
no reason / Error null null {...} / {} null null null
null garbled "Aborted" null "Aborted" null garbled "Aborted" null
"abcd" (base64-like string) garbled "abcd" "abcd" "abcd" garbled garbled
"Abort works!", 5 same same same same same same
true undefined true true true undefined undefined
{ a: 1 } null { a: 1 } { a: 1 } { a: 1 } null null

statusText is now always "Aborted", so non-Latin-1 reasons no longer throw a TypeError on Node.

responseEncoding: "base64" matches the old behavior exactly except for the abort null / Error cases above.

@linear-code

linear-code Bot commented Oct 14, 2026

Copy link
Copy Markdown

DX-3137

@ytkimirti
ytkimirti marked this pull request as ready for review October 14, 2026 09:36
CahidArda
CahidArda previously approved these changes Oct 21, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟢 Approval recommended

No blocking issues remain; the release-note clarification is a minor documentation follow-up.

1 open issue
What changed in this PR

Changes Redis responses to plain JSON by default, reducing transfer size while preserving explicit base64 support.

Changes:

  • Updates the encoding default and documents compatibility differences.
  • Normalizes static abort responses and updates tests.
  • Extends CI’s npm publication wait window.
File Description
packages/​redis/​pkg/​redis.test.ts Tests explicit base64 opt-in.
packages/​redis/​pkg/​http.ts Changes encoding defaults and abort handling.
packages/​redis/​pkg/​http.test.ts Updates mocks and adds abort tests.
.github/​workflows/​tests.yaml Extends npm availability polling.
.changeset/​plain-response-encoding.md Documents the release’s behavior changes.

Review effort: Balanced

Comment thread .changeset/plain-response-encoding.md
@CahidArda
CahidArda merged commit 2254796 into main Oct 21, 2026
17 checks passed
@CahidArda
CahidArda deleted the DX-3137-plain-encoding branch October 21, 2026 10:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants