Commit e5bf00e
feat(websocket): add handshake response info to undici:websocket:open diagnostic event (#4396)
* feat(websocket): add handshake response info to undici:websocket:open diagnostic event
- Add handshakeResponse object to undici:websocket:open diagnostic event
- Include status, statusText, and headers from HTTP handshake response
- Enables Chrome DevTools Protocol Network.webSocketHandshakeResponseReceived support
- Add comprehensive test coverage for handshake response diagnostic data
Fixes #4394
* fix(websocket/diagnostics): use headersList.headersMap.entries() for diagnostics channel event emission
- Fixes diagnostics channel WebSocket event emission and related test timeouts in Node.js 20+.
- Cleans up debug/test scripts and logs.
* fix(websocket/diagnostics): clean up after review, remove debug logs, redundant checks, and improve handshake header assertions in test
* refactor: use HeadersList.entries getter for WebSocket diagnostic headers
- Replace Object.fromEntries(response.headersList.headersMap.entries()) with response.headersList.entries
- Use the built-in getter method from HeadersList class for cleaner, more efficient code
- Update test to match new plain object format (remove .value property access)
- Fix test plan count to match actual number of assertions (11)
Addresses KhafraDev's code review feedback to use the purpose-built entries getter.
* docs: document handshakeResponse in websocket:open diagnostics
- Add handshakeResponse object documentation to DiagnosticsChannel.md
- Remove console.log statements from test file
- Fix linting issues in test file
* test: remove console.log and mark unused WebSocket variable
---------
Co-authored-by: tawseefnabi <tawseefnabi9@gamil.com>1 parent c3f5591 commit e5bf00e
3 files changed
Lines changed: 84 additions & 2 deletions
File tree
- docs/docs/api
- lib/web/websocket
- test/websocket
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
172 | | - | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
173 | 179 | | |
174 | 180 | | |
175 | 181 | | |
176 | 182 | | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
177 | 188 | | |
178 | 189 | | |
179 | 190 | | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
| 199 | + | |
| 200 | + | |
| 201 | + | |
| 202 | + | |
| 203 | + | |
180 | 204 | | |
181 | 205 | | |
182 | 206 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
| 486 | + | |
485 | 487 | | |
486 | 488 | | |
487 | 489 | | |
488 | 490 | | |
489 | | - | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
490 | 497 | | |
491 | 498 | | |
492 | 499 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
0 commit comments