(ctx context.Context, request []byte)
| 153 | } |
| 154 | |
| 155 | func (h *Host) callHostHTTPDoStream(ctx context.Context, request []byte) ([]byte, error) { |
| 156 | httpReq, callbackID, errDecode := decodeHostHTTPRequestWithCallbackID(request) |
| 157 | if errDecode != nil { |
| 158 | return nil, errDecode |
| 159 | } |
| 160 | ctx = h.resolveCallbackContext(callbackID, ctx) |
| 161 | if ctx == nil { |
| 162 | ctx = context.Background() |
| 163 | } |
| 164 | streamCtx, cancel := context.WithCancel(ctx) |
| 165 | resp, errDo := h.newHTTPClient(nil).DoStream(streamCtx, httpReq) |
| 166 | if errDo != nil { |
| 167 | cancel() |
| 168 | return nil, errDo |
| 169 | } |
| 170 | streamID := "" |
| 171 | if h != nil && h.httpStreams != nil { |
| 172 | streamID = h.httpStreams.open(resp.Chunks, cancel) |
| 173 | } |
| 174 | if streamID == "" { |
| 175 | cancel() |
| 176 | return nil, fmt.Errorf("host http stream bridge is unavailable") |
| 177 | } |
| 178 | return marshalRPCResult(rpcHostHTTPStreamResponse{ |
| 179 | StatusCode: resp.StatusCode, |
| 180 | Headers: httpHeader(resp.Headers), |
| 181 | StreamID: streamID, |
| 182 | }) |
| 183 | } |
| 184 | |
| 185 | func (h *Host) callHostHTTPStreamRead(ctx context.Context, request []byte) ([]byte, error) { |
| 186 | var req rpcHostHTTPStreamReadRequest |
no test coverage detected