sendChunk sends a single chunk of exactly maxChunkSize (or less)
(data []byte)
| 62 | |
| 63 | // sendChunk sends a single chunk of exactly maxChunkSize (or less) |
| 64 | func (w *StreamingResponseWriter) sendChunk(data []byte) { |
| 65 | if len(data) == 0 { |
| 66 | return |
| 67 | } |
| 68 | chunk := make([]byte, len(data)) |
| 69 | copy(chunk, data) |
| 70 | w.respChan <- wshrpc.RespOrErrorUnion[wshrpc.VDomUrlRequestResponse]{ |
| 71 | Response: wshrpc.VDomUrlRequestResponse{ |
| 72 | Body: chunk, |
| 73 | }, |
| 74 | } |
| 75 | } |
| 76 | |
| 77 | func (w *StreamingResponseWriter) Write(data []byte) (int, error) { |
| 78 | if !w.headerSent { |