Commit e120edb
Go: carry frame type through WebSocket intercept callbacks + add message helpers
Addresses two cross-SDK consistency gaps on the Go request-handler API
flagged in review:
- Widen OnSendRequestMessage / OnSendResponseMessage from
func([]byte) []byte to func(CopilotWebSocketMessage) *CopilotWebSocketMessage
so callbacks can inspect and change a frame's text/binary type, matching
the CopilotWebSocketMessage-based hooks in the .NET, Rust, and Java SDKs.
Returning nil still drops the frame, preserving existing semantics.
- Add Text(), NewTextMessage(), and NewBinaryMessage() convenience helpers
to CopilotWebSocketMessage, mirroring the factory/getter helpers the other
strongly-typed SDKs provide.
This is a new experimental API, so aligning the shape now avoids a later
breaking change. Updates the lone internal call site in the e2e handler test.
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent eb0dafe commit e120edb
2 files changed
Lines changed: 38 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
81 | 81 | | |
82 | 82 | | |
83 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
84 | 97 | | |
85 | 98 | | |
86 | 99 | | |
| |||
360 | 373 | | |
361 | 374 | | |
362 | 375 | | |
363 | | - | |
364 | | - | |
| 376 | + | |
| 377 | + | |
| 378 | + | |
| 379 | + | |
365 | 380 | | |
366 | | - | |
367 | | - | |
| 381 | + | |
| 382 | + | |
| 383 | + | |
| 384 | + | |
368 | 385 | | |
369 | 386 | | |
370 | 387 | | |
| |||
422 | 439 | | |
423 | 440 | | |
424 | 441 | | |
425 | | - | |
| 442 | + | |
426 | 443 | | |
427 | | - | |
428 | | - | |
| 444 | + | |
| 445 | + | |
429 | 446 | | |
430 | 447 | | |
| 448 | + | |
431 | 449 | | |
432 | | - | |
433 | | - | |
| 450 | + | |
| 451 | + | |
434 | 452 | | |
435 | | - | |
| 453 | + | |
436 | 454 | | |
437 | 455 | | |
438 | 456 | | |
439 | 457 | | |
440 | 458 | | |
441 | | - | |
| 459 | + | |
442 | 460 | | |
443 | | - | |
444 | | - | |
| 461 | + | |
| 462 | + | |
445 | 463 | | |
446 | 464 | | |
| 465 | + | |
447 | 466 | | |
448 | 467 | | |
449 | 468 | | |
450 | 469 | | |
451 | 470 | | |
452 | | - | |
| 471 | + | |
453 | 472 | | |
454 | 473 | | |
455 | | - | |
| 474 | + | |
456 | 475 | | |
457 | 476 | | |
458 | 477 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
149 | | - | |
| 149 | + | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | | - | |
| 153 | + | |
154 | 154 | | |
155 | | - | |
| 155 | + | |
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
| |||
0 commit comments