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

Increase request execution timeout duration for "Try it" feature in ApiDemoPanel #327

Closed
devgeetech opened this issue Nov 5, 2022 · 4 comments
Labels
bug Something isn't working

Comments

@devgeetech
Copy link

Describe the bug

For the "Try It" feature, if the request takes more than 5 seconds to complete execution, the ApiDemoPanel will show a "Connection Failed" error.

Expected behavior

The ApiDemoPanel shows the response even if the request takes more than 5 seconds to complete

Current behavior

The ApiDemoPanel shows a "Connection Failed" error. The request actually completes its execution and returns a response (verified from the network tab)

Possible solution

The timeout is hardcoded in makeRequest.ts (line 15). If there is no specific reason for choosing that value, it can be increased to a higher timeout.

Another option is to add a new plugin config variable that let's the user choose a timeout value themselves.

Steps to reproduce

Can be reproduced by sending an API requesting in the ApiDemoPanel that takes more than 5 seconds to return a response.

Context

I am building the documentation for a text-to-speech API that sometimes takes a fair bit of time to generate a response. It would be awesome if the "Try it" feature worked for slower APIs too.

Your Environment

  • Version used: 1.2.1
@devgeetech devgeetech added the bug Something isn't working label Nov 5, 2022
@welcome-to-palo-alto-networks
Copy link

🎉 Thanks for opening your first issue here! Welcome to the community!

@sserrata
Copy link
Member

sserrata commented Nov 7, 2022

Hi @devgeetech, thanks for reporting this issue. I think a new plugin config option that allows users to configure the timeout makes sense. We'll add it to our backlog of feature requests.

@sserrata
Copy link
Member

sserrata commented Dec 1, 2022

@devgeetech, we recently improved support for swizzling OpenAPI docs theme components, including the makeRequest.ts module that handles generating the request. That said, it should be possible to swizzle in order to override the timeout.

@sserrata
Copy link
Member

sserrata commented Dec 2, 2022

Closing since this option is now supported with swizzling. Will revisit possibility of adding a timeout plugin option in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants