| 4 | |
| 5 | Y_UNIT_TEST_SUITE(THttpTestMedium) { |
| 6 | Y_UNIT_TEST(TestCodings2) { |
| 7 | TStringBuf data = "aaaaaaaaaaaaaaaaaaaaaaa"; |
| 8 | |
| 9 | for (auto codec : SupportedCodings()) { |
| 10 | if (codec == TStringBuf("z-zlib-0")) { |
| 11 | continue; |
| 12 | } |
| 13 | |
| 14 | if (codec == TStringBuf("z-null")) { |
| 15 | continue; |
| 16 | } |
| 17 | |
| 18 | TString s; |
| 19 | |
| 20 | { |
| 21 | TStringOutput so(s); |
| 22 | THttpOutput ho(&so); |
| 23 | TBufferedOutput bo(&ho, 10000); |
| 24 | |
| 25 | bo << "HTTP/1.1 200 Ok\r\n" |
| 26 | << "Connection: close\r\n" |
| 27 | << "Content-Encoding: " << codec << "\r\n\r\n"; |
| 28 | |
| 29 | for (size_t i = 0; i < 100; ++i) { |
| 30 | bo << data; |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | try { |
| 35 | UNIT_ASSERT(s.size() > 10); |
| 36 | UNIT_ASSERT(s.find(data) == TString::npos); |
| 37 | } catch (...) { |
| 38 | Cerr << codec << " " << s << Endl; |
| 39 | |
| 40 | throw; |
| 41 | } |
| 42 | |
| 43 | { |
| 44 | TStringInput si(s); |
| 45 | THttpInput hi(&si); |
| 46 | |
| 47 | auto res = hi.ReadAll(); |
| 48 | |
| 49 | UNIT_ASSERT(res.find(data) == 0); |
| 50 | } |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | } // THttpTestMedium suite |
nothing calls this directly
no test coverage detected