(payload []byte, typ string)
| 573 | } |
| 574 | |
| 575 | func (*StreamingInterception) encodeForStream(payload []byte, typ string) []byte { |
| 576 | // bytes.Buffer writes to in-memory storage and never return errors. |
| 577 | var buf bytes.Buffer |
| 578 | _, _ = buf.WriteString("event: ") |
| 579 | _, _ = buf.WriteString(typ) |
| 580 | _, _ = buf.WriteString("\n") |
| 581 | _, _ = buf.WriteString("data: ") |
| 582 | _, _ = buf.Write(payload) |
| 583 | _, _ = buf.WriteString("\n\n") |
| 584 | return buf.Bytes() |
| 585 | } |
| 586 | |
| 587 | // newStream traces svc.NewStreaming() call. |
| 588 | func (i *StreamingInterception) newStream(ctx context.Context, svc anthropic.MessageService) *ssestream.Stream[anthropic.MessageStreamEventUnion] { |
no test coverage detected