Returns a 'BODY' response once the body of the provided 'PIPE' response can be read completely.
| 1192 | // Returns a 'BODY' response once the body of the provided |
| 1193 | // 'PIPE' response can be read completely. |
| 1194 | Future<Response> convert(const Response& pipeResponse) |
| 1195 | { |
| 1196 | CHECK_EQ(Response::PIPE, pipeResponse.type); |
| 1197 | CHECK_SOME(pipeResponse.reader); |
| 1198 | |
| 1199 | Pipe::Reader reader = pipeResponse.reader.get(); |
| 1200 | |
| 1201 | return reader.readAll() |
| 1202 | .then([pipeResponse](const string& body) { |
| 1203 | Response bodyResponse = pipeResponse; |
| 1204 | bodyResponse.type = Response::BODY; |
| 1205 | bodyResponse.body = body; |
| 1206 | bodyResponse.reader = None(); // Remove the reader. |
| 1207 | return bodyResponse; |
| 1208 | }); |
| 1209 | } |
| 1210 | |
| 1211 | |
| 1212 | class ConnectionProcess : public Process<ConnectionProcess> |