Skip to content

Expose onRequest in RequestOptions for SSE request interception#3392

Open
Copilot wants to merge 5 commits intomainfrom
copilot/expose-onrequest-sse-options
Open

Expose onRequest in RequestOptions for SSE request interception#3392
Copilot wants to merge 5 commits intomainfrom
copilot/expose-onrequest-sse-options

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Plan: Add onRequest to RequestOptions Type

  • Identify all client bundle types.ts files that need updating
  • Add onRequest to the Pick statement in each RequestOptions interface
  • Build the project to verify no type errors
  • Run tests to ensure functionality works correctly
  • Verify the fix by checking generated types
  • Update all examples (12 files)
  • Update all test snapshots (239 files)
  • Fix type errors in nuxt/ofetch snapshots

Files Updated:

  1. /packages/openapi-ts/src/plugins/@hey-api/client-fetch/bundle/types.ts
  2. /packages/openapi-ts/src/plugins/@hey-api/client-axios/bundle/types.ts
  3. /packages/openapi-ts/src/plugins/@hey-api/client-ky/bundle/types.ts
  4. /packages/openapi-ts/src/plugins/@hey-api/client-next/bundle/types.ts
  5. /packages/openapi-ts/src/plugins/@hey-api/client-angular/bundle/types.ts
  6. ⚠️ /packages/openapi-ts/src/plugins/@hey-api/client-nuxt/bundle/types.ts - Already has onRequest from FetchOptions
  7. ⚠️ /packages/openapi-ts/src/plugins/@hey-api/client-ofetch/bundle/types.ts - Already has onRequest from OfetchOptions

Examples and Snapshots Updated:

  • ✅ 12 example files regenerated with onRequest exposed
  • ✅ 239 test snapshot files updated with onRequest in the Pick statement
  • ✅ 24 nuxt/ofetch snapshot files corrected (removed onRequest to avoid conflicts)

Summary:

Added onRequest to the RequestOptions interface's Pick statement for 5 client bundles (fetch, axios, ky, next, angular). The client-nuxt and client-ofetch bundles were excluded from having onRequest in the Pick statement because they already have it in their Config interfaces. All examples and test snapshots have been updated accordingly.

Original prompt

This section details on the original issue you should resolve

<issue_title>In RequestOptions expose onRequest for ServerSentEventsOptions because it is needed to update an authorization token header</issue_title>
<issue_description>### Description

In the type generated in types.gen.ts

export interface RequestOptions<TData = unknown, ThrowOnError extends boolean = boolean, Url extends string = string>
  extends
    Config<{
      throwOnError: ThrowOnError;
    }>,
    Pick<
      ServerSentEventsOptions<TData>,
      'onSseError' | 'onSseEvent' | 'sseDefaultRetryDelay' | 'sseMaxRetryAttempts' | 'sseMaxRetryDelay'
    > {
  /**
   * Any body that you want to add to your request.
   *
   * {@link https://developer.mozilla.org/docs/Web/API/fetch#body}
   */
  body?: unknown;
  path?: Record<string, unknown>;
  query?: Record<string, unknown>;
  /**
   * Security mechanism(s) to use for the request.
   */
  security?: ReadonlyArray<Auth>;
  url: Url;
}

onRequestfrom ServerSentEventsOptions is not picked, but it is needed for when we want to update the authorization token header in a retry.

</issue_description>

Comments on the Issue (you are @copilot in this section)

@mrlubos @amarant Is this just a type issue or is the implementation missing too?

💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

@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 Feb 13, 2026

⚠️ No Changeset found

Latest commit: 0bc7a8b

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@vercel
Copy link

vercel bot commented Feb 13, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
hey-api-docs Ready Ready Preview, Comment Feb 13, 2026 9:28pm

Request Review

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Copilot AI changed the title [WIP] Expose onRequest for ServerSentEventsOptions in RequestOptions Expose onRequest in RequestOptions for SSE request interception Feb 13, 2026
Copilot AI requested a review from mrlubos February 13, 2026 18:11
@mrlubos
Copy link
Member

mrlubos commented Feb 13, 2026

@copilot update snapshots and examples

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot update snapshots and examples

Updated all snapshots and examples. Changes include:

  • 12 example files regenerated with onRequest exposed
  • 239 test snapshot files updated with onRequest in the Pick statement

Commit: 06f773f

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/openapi-ts/openapi-ts/node_modules/.pnpm/next@15.2.4_react-dom@19.0.0_react@19.0.0__react@19.0.0_sass@1.97.1/node_modules/next/dist/compiled/jest-worker/processChild.js _modules/.bin/nong build sh ./vi�� openapi-ts bash cal/share/pnpm/.tools/pnpm/10.28.2/node_modules/pnpm/dist/node-gyp-bin/oxfmt --noprofile (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@mrlubos mrlubos marked this pull request as ready for review February 13, 2026 20:51
@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. feature 🚀 Feature request. labels Feb 13, 2026
@mrlubos
Copy link
Member

mrlubos commented Feb 13, 2026

@copilot CI checks are failing, figure out why and fix them

Co-authored-by: mrlubos <12529395+mrlubos@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Feb 13, 2026

@copilot CI checks are failing, figure out why and fix them

Fixed the CI failures. The issue was that test snapshots for client-nuxt and client-ofetch had onRequest in the Pick statement, but these clients already have onRequest in their Config interfaces (from their underlying libraries), causing type conflicts.

Removed onRequest from 24 snapshot files for client-nuxt and client-ofetch.

All CI checks now pass:

  • ✅ Examples check
  • ✅ Type check (including heavy tests)
  • ✅ Linting
  • ✅ Unit tests

Commit: 0bc7a8b

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • fonts.googleapis.com
    • Triggering command: /opt/hostedtoolcache/node/24.13.0/x64/bin/node /opt/hostedtoolcache/node/24.13.0/x64/bin/node /home/REDACTED/work/openapi-ts/openapi-ts/node_modules/.pnpm/next@15.2.4_react-dom@19.0.0_react@19.0.0__react@19.0.0_sass@1.97.1/node_modules/next/dist/compiled/jest-worker/processChild.js tack-svelte-querrun uname napi�� js node napi-ts/node_modules/.bin/node n/openapi-ts bash y/node_modules/.vite build node tool�� 1 1 --report-unused-disable-directives k/openapi-ts/openapi-ts/node_modules/.bin/node 0 dirname (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@codecov
Copy link

codecov bot commented Feb 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.59%. Comparing base (1f6fb21) to head (0bc7a8b).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3392   +/-   ##
=======================================
  Coverage   39.59%   39.59%           
=======================================
  Files         473      473           
  Lines       17080    17080           
  Branches     5230     5224    -6     
=======================================
  Hits         6763     6763           
  Misses       8266     8266           
  Partials     2051     2051           
Flag Coverage Δ
unittests 39.59% <ø> (ø)

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature 🚀 Feature request. size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

In RequestOptions expose onRequest for ServerSentEventsOptions because it is needed to update an authorization token header

2 participants