这是indexloc提供的服务,不要输入任何密码
Skip to content

Conversation

@dovca
Copy link
Contributor

@dovca dovca commented Aug 7, 2025

Fix #2395

This PR implements a new property on request options: serializedBody. It introduces the following BREAKING CHANGE:

When accessing options.body in request or response interceptors, the value is now the original raw value passed to the request. Previously, if a bodySerializer was specified, options.body would have the serialized value. This only affects the fetch and next clients. nuxt and axios clients have their own ways of defining interceptors that are out of the scope of this package.

One might argue, that the previous serialized value was correct, because that was the real value actually passed to the fetch function. However, each generated API request function is strictly typed and replacing the body with its serialized version goes against that.

No previously available information is lost, because now both raw and serialized bodies are available.

I also defined a new ResolvedRequestOptions interface to emphasize the difference between the input options for each request and a transformed version meant for reading back.

@bolt-new-by-stackblitz
Copy link

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

@changeset-bot
Copy link

changeset-bot bot commented Aug 7, 2025

🦋 Changeset detected

Latest commit: 04fc0f3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hey-api/openapi-ts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Aug 7, 2025

@dovca is attempting to deploy a commit to the Hey API Team on Vercel.

A member of the Team first needs to authorize it.

@dosubot dosubot bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Aug 7, 2025
@dosubot dosubot bot added client Client package related feature 🚀 New feature or request labels Aug 7, 2025
@pkg-pr-new
Copy link

pkg-pr-new bot commented Aug 7, 2025

Open in StackBlitz

npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/nuxt@2406
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/openapi-ts@2406
npm i https://pkg.pr.new/hey-api/openapi-ts/@hey-api/vite-plugin@2406

commit: ae99831

@codecov
Copy link

codecov bot commented Aug 7, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 22.46%. Comparing base (1f9ec97) to head (ae99831).
⚠️ Report is 11 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2406      +/-   ##
==========================================
- Coverage   22.46%   22.46%   -0.01%     
==========================================
  Files         324      324              
  Lines       31956    31975      +19     
  Branches     1234     1234              
==========================================
+ Hits         7179     7182       +3     
- Misses      24768    24784      +16     
  Partials        9        9              
Flag Coverage Δ
unittests 22.46% <ø> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mrlubos
Copy link
Member

mrlubos commented Aug 7, 2025

Just leaving a note that I've seen this and will come back to review and merge

Copy link
Member

@mrlubos mrlubos left a comment

Choose a reason for hiding this comment

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

image

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Aug 8, 2025
@mrlubos mrlubos merged commit 28bc015 into hey-api:main Aug 8, 2025
2 of 13 checks passed
@github-actions github-actions bot mentioned this pull request Aug 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

client Client package related feature 🚀 New feature or request lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Preserve request body before serialization for use in request and response interceptors

2 participants