| 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; |
no test coverage detected