(payload []byte, typ string)
| 670 | } |
| 671 | |
| 672 | func (*StreamingInterception) encodeForStream(payload []byte, typ string) []byte { |
| 673 | // bytes.Buffer writes to in-memory storage and never return errors. |
| 674 | var buf bytes.Buffer |
| 675 | _, _ = buf.WriteString("event: ") |
| 676 | _, _ = buf.WriteString(typ) |
| 677 | _, _ = buf.WriteString("\n") |
| 678 | _, _ = buf.WriteString("data: ") |
| 679 | _, _ = buf.Write(payload) |
| 680 | _, _ = buf.WriteString("\n\n") |
| 681 | return buf.Bytes() |
| 682 | } |
| 683 | |
| 684 | // newStream traces svc.NewStreaming() call. |
| 685 | func (i *StreamingInterception) newStream(ctx context.Context, svc anthropic.MessageService, extraOpts ...option.RequestOption) *ssestream.Stream[anthropic.MessageStreamEventUnion] { |
no test coverage detected