Skip to content

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

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 2 commits into from
Mar 24, 2025

Conversation

dvaJi
Copy link
Contributor

@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

github-actions bot commented Dec 10, 2024

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

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

(expires Wed, 23 Apr 2025 15:33:18 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.

@sserrata
Copy link
Member

Tested using Azure OpenAI chat completion endpoint with streaming response:

Screenshot 2025-03-24 at 11 29 22 AM

@sserrata sserrata merged commit 784ce87 into PaloAltoNetworks:main Mar 24, 2025
16 of 17 checks passed
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