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

Add support for Server-Sent Events (SSE) in API Explorer and configuration #1041

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

dvaJi
Copy link

@dvaJi dvaJi commented Dec 10, 2024

Description

Added support for Server-Sent Events (SSE) to handle streaming responses in the docusaurus-theme-openapi-docs library. This includes a new handleEventStream function to process SSE responses and update the state accordingly.

Motivation and Context

This change is required to support APIs that use Server-Sent Events (SSE) for streaming data. It solves the problem of handling real-time updates from the server, which was not supported previously (it waits until the request is closed). This enhancement allows users to see live updates in the API response section.

How Has This Been Tested?

Tested locally by linking the modified docusaurus-theme-openapi-docs library to another project and verifying that SSE responses are handled correctly. Specifically:

  • Verified that the response updates in real-time as data is received from the server.
  • Ensured that non-SSE responses are still handled correctly.
  • Tested with various content types and ensured proper decoding and display.

Screenshots (if appropriate)

Types of changes

  • New feature (non-breaking change which adds functionality)

Checklist

  • I have updated the documentation accordingly.
  • I have read the CONTRIBUTING document.
  • I have added tests to cover my changes if appropriate.
  • All new and existing tests passed.

Copy link

Visit the preview URL for this PR (updated for commit 54164dc):

https://docusaurus-openapi-36b86--pr1041-j1c1n0v9.web.app

(expires Thu, 09 Jan 2025 21:53:32 GMT)

🔥 via Firebase Hosting GitHub Action 🌎

Sign: bf293780ee827f578864d92193b8c2866acd459f

@sserrata
Copy link
Member

Thanks for the contribution @dvaJi, planning to review it for the next release.

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