Skip to content
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

Issue with post middleware when it clones the response #69

Open
vargas88hugo opened this issue May 2, 2024 · 0 comments
Open

Issue with post middleware when it clones the response #69

vargas88hugo opened this issue May 2, 2024 · 0 comments

Comments

@vargas88hugo
Copy link

vargas88hugo commented May 2, 2024

Hi all,

First of all, thank you for you excellent library.

I wanted to let you know I found an issue while using a custom post middleware in my autogenerated client. It seems that the autogenerated runtime.ts file is passing a cloned response, which can lead to timeout issues when dealing with large responses.

This is part of the code of the autogenerated runtime.ts file that I updated:

for (const middleware of this.middleware) {
  if (middleware.post) {
      response = await middleware.post({
          fetch: this.fetchApi,
          url: fetchParams.url,
          init: fetchParams.init,
          response: response, // response.clone() method was deleted because it doesn't support large responses
      }) || response;
  }
}

I'm wondering if this change may cause unexpected problems and if you have found any better approach for this.

Thank you for your attention to this matter. Looking forward to your insights.

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

No branches or pull requests

1 participant