Skip to content

fix: send responseReceived with EventSource type for SSE requests#63

Open
BAIXIONGSODA wants to merge 1 commit intoGrinZero:mainfrom
BAIXIONGSODA:fix/sse-optimization
Open

fix: send responseReceived with EventSource type for SSE requests#63
BAIXIONGSODA wants to merge 1 commit intoGrinZero:mainfrom
BAIXIONGSODA:fix/sse-optimization

Conversation

@BAIXIONGSODA
Copy link
Copy Markdown

PR: Fix SSE (Server-Sent Events) DevTools Display

Summary

This PR fixes the SSE request display in Chrome DevTools Network panel by sending Network.responseReceived with type: EventSource before streaming SSE messages.

Changes

packages/network-debugger/src/core/fetch.ts

  • Add loadCallFrames() call to capture initiator stack trace for fetch requests
  • Send eventSourceResponseReceived message to properly notify DevTools about SSE responses

packages/network-debugger/src/fork/module/network/index.ts

  • Add new handler eventSourceResponseReceived to send Network.responseReceived with type: EventSource
  • This ensures DevTools correctly identifies and displays SSE requests

Why

Previously, SSE requests were not properly displayed in DevTools because the responseReceived event was not sent with the correct type: EventSource. This fix ensures:

  1. SSE requests show up correctly in the Network panel
  2. The request type is properly identified as EventSource
  3. Initiator stack trace is captured for better debugging

Testing

Tested with koa-esm app's /sse-fetch endpoint - SSE events are now properly captured and displayed in DevTools.

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.

1 participant