MCPcopy Create free account
hub / github.com/3rdparty/libprocess / convert

Function convert

src/http.cpp:1108–1123  ·  view source on GitHub ↗

Returns a 'BODY' response once the body of the provided 'PIPE' response can be read completely.

Source from the content-addressed store, hash-verified

1106// Returns a 'BODY' response once the body of the provided
1107// 'PIPE' response can be read completely.
1108Future<Response> convert(const Response& pipeResponse)
1109{
1110 CHECK_EQ(Response::PIPE, pipeResponse.type);
1111 CHECK_SOME(pipeResponse.reader);
1112
1113 Pipe::Reader reader = pipeResponse.reader.get();
1114
1115 return reader.readAll()
1116 .then([pipeResponse](const string& body) {
1117 Response bodyResponse = pipeResponse;
1118 bodyResponse.type = Response::BODY;
1119 bodyResponse.body = body;
1120 bodyResponse.reader = None(); // Remove the reader.
1121 return bodyResponse;
1122 });
1123}
1124
1125
1126class ConnectionProcess : public Process<ConnectionProcess>

Callers 1

_readMethod · 0.70

Calls 3

readAllMethod · 0.80
getMethod · 0.45
thenMethod · 0.45

Tested by

no test coverage detected