Skip to content

Fix snippet for Handling statefulness in openapi-fetch/middleware-auth page #2386

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2025

Conversation

PonomareVlad
Copy link
Contributor

Changes

Fix snippet for Handling statefulness in openapi-fetch/middleware-auth page

How to Review

Check snippet in IDE

@Copilot Copilot AI review requested due to automatic review settings July 30, 2025 15:16
@PonomareVlad PonomareVlad requested a review from a team as a code owner July 30, 2025 15:16
@PonomareVlad PonomareVlad requested a review from gzm0 July 30, 2025 15:16
Copy link

netlify bot commented Jul 30, 2025

👷 Deploy request for openapi-ts pending review.

Visit the deploys page to approve it

Name Link
🔨 Latest commit 54444f2

Copy link

changeset-bot bot commented Jul 30, 2025

⚠️ No Changeset found

Latest commit: 54444f2

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

Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR fixes a code snippet in the openapi-fetch middleware documentation by adding the missing async keyword to an onResponse function that uses await.

  • Adds async keyword to the onResponse function in a middleware example
  • Ensures proper async/await syntax consistency in the documentation code snippet

@@ -175,7 +175,7 @@ By default, `openapi-fetch` will **NOT** arbitrarily clone requests/responses fo
<!-- prettier-ignore -->
```ts
const myMiddleware: Middleware = {
onResponse({ response }) {
async onResponse({ response }) {
Copy link
Preview

Copilot AI Jul 30, 2025

Choose a reason for hiding this comment

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

The fix correctly addresses a syntax error where await was being used without the function being declared as async. This would have caused a compilation error if users copied the code snippet.

Copilot uses AI. Check for mistakes.

Copy link
Contributor

@gzm0 gzm0 left a comment

Choose a reason for hiding this comment

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

TY for the fix!

@gzm0 gzm0 enabled auto-merge (squash) July 30, 2025 15:18
@gzm0 gzm0 merged commit cbd0f37 into openapi-ts:main Jul 30, 2025
7 checks passed
@PonomareVlad PonomareVlad deleted the patch-1 branch July 30, 2025 16:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants