MCPcopy Create free account
hub / github.com/catboost/catboost / MakeHttpOutputBody

Function MakeHttpOutputBody

library/cpp/http/io/stream_ut.cpp:335–358  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

333 }
334
335 TString MakeHttpOutputBody(const char* body, bool encodingEnabled) {
336 TString str;
337 TStringOutput strOut(str);
338 {
339 TBufferedOutput bufOut(&strOut, 8192);
340 THttpOutput httpOut(&bufOut);
341
342 httpOut.EnableKeepAlive(true);
343 httpOut.EnableCompression(true);
344 httpOut.EnableBodyEncoding(encodingEnabled);
345
346 httpOut << "POST / HTTP/1.1\r\n";
347 httpOut << "Host: yandex.ru\r\n";
348 httpOut << "Content-Encoding: gzip\r\n";
349 httpOut << "\r\n";
350
351 UNIT_ASSERT_VALUES_EQUAL(str.size(), 0u);
352 httpOut << body;
353 }
354 const char* bodyDelimiter = "\r\n\r\n";
355 size_t bodyPos = str.find(bodyDelimiter);
356 UNIT_ASSERT(bodyPos != TString::npos);
357 return str.substr(bodyPos + strlen(bodyDelimiter));
358 }
359
360 TString SimulateBodyEncoding(const char* body) {
361 TString bodyStr;

Callers 1

Y_UNIT_TESTFunction · 0.85

Calls 6

EnableKeepAliveMethod · 0.45
EnableCompressionMethod · 0.45
EnableBodyEncodingMethod · 0.45
sizeMethod · 0.45
findMethod · 0.45
substrMethod · 0.45

Tested by

no test coverage detected