fix: use serializedBody instead of raw body in fetch client SSE handler#3467
fix: use serializedBody instead of raw body in fetch client SSE handler#3467bilby91 wants to merge 1 commit intohey-api:mainfrom
Conversation
The makeSseFn function was passing opts.body (the raw JS object) to createSseClient instead of opts.serializedBody, causing POST SSE endpoints with JSON bodies to send [object Object]. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
|
|
@bilby91 is attempting to deploy a commit to the Hey API Team on Vercel. A member of the Team first needs to authorize it. |
|
Leaping into action... |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #3467 +/- ##
=======================================
Coverage 40.11% 40.11%
=======================================
Files 478 478
Lines 17488 17488
Branches 5294 5294
=======================================
Hits 7016 7016
Misses 8425 8425
Partials 2047 2047
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
| return createSseClient({ | ||
| ...opts, | ||
| body: opts.body as BodyInit | null | undefined, | ||
| body: opts.serializedBody as BodyInit | null | undefined, |
There was a problem hiding this comment.
@bilby91 how would this fix it? there's already serializedBody below and that's what's used
|
Closing this PR — after rebasing with main and reviewing the code more carefully, the fix is not needed.
const requestInit: RequestInit = {
redirect: 'follow',
...options,
body: options.serializedBody, // ← always uses serializedBody regardless of what body was set to
headers,
signal,
};So the Thanks @mrlubos for pointing this out! |

The makeSseFn function was passing opts.body (the raw JS object) to createSseClient instead of opts.serializedBody, causing POST SSE endpoints with JSON bodies to send [object Object].