diff options
author | panch <panch@yandex-team.ru> | 2022-02-10 16:49:46 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:46 +0300 |
commit | a27ec9dbf04ab9972fd470b53b8bdd41153226e5 (patch) | |
tree | 5d5cb817648f650d76cf1076100726fd9b8448e8 /library/cpp/http/io/stream_ut.cpp | |
parent | d1745921955862f856896f8b5947304e212345c3 (diff) | |
download | ydb-a27ec9dbf04ab9972fd470b53b8bdd41153226e5.tar.gz |
Restoring authorship annotation for <panch@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'library/cpp/http/io/stream_ut.cpp')
-rw-r--r-- | library/cpp/http/io/stream_ut.cpp | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/library/cpp/http/io/stream_ut.cpp b/library/cpp/http/io/stream_ut.cpp index 6f0eec67b6..1ea35df675 100644 --- a/library/cpp/http/io/stream_ut.cpp +++ b/library/cpp/http/io/stream_ut.cpp @@ -332,7 +332,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { UNIT_ASSERT_VALUES_EQUAL(checkStr.size(), str.size()); } - TString MakeHttpOutputBody(const char* body, bool encodingEnabled) { + TString MakeHttpOutputBody(const char* body, bool encodingEnabled) { TString str; TStringOutput strOut(str); { @@ -341,7 +341,7 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { httpOut.EnableKeepAlive(true); httpOut.EnableCompression(true); - httpOut.EnableBodyEncoding(encodingEnabled); + httpOut.EnableBodyEncoding(encodingEnabled); httpOut << "POST / HTTP/1.1\r\n"; httpOut << "Host: yandex.ru\r\n"; @@ -354,22 +354,22 @@ Y_UNIT_TEST_SUITE(THttpStreamTest) { const char* bodyDelimiter = "\r\n\r\n"; size_t bodyPos = str.find(bodyDelimiter); UNIT_ASSERT(bodyPos != TString::npos); - return str.substr(bodyPos + strlen(bodyDelimiter)); - }; - - TString SimulateBodyEncoding(const char* body) { - TString bodyStr; - TStringOutput bodyOut(bodyStr); - TChunkedOutput chunkOut(&bodyOut); - TZLibCompress comprOut(&chunkOut, ZLib::GZip); - comprOut << body; - return bodyStr; - }; - - Y_UNIT_TEST(TestRebuildStreamOnPost) { - const char* body = "<html>Hello</html>"; - UNIT_ASSERT(MakeHttpOutputBody(body, false) == body); - UNIT_ASSERT(MakeHttpOutputBody(body, true) == SimulateBodyEncoding(body)); + return str.substr(bodyPos + strlen(bodyDelimiter)); + }; + + TString SimulateBodyEncoding(const char* body) { + TString bodyStr; + TStringOutput bodyOut(bodyStr); + TChunkedOutput chunkOut(&bodyOut); + TZLibCompress comprOut(&chunkOut, ZLib::GZip); + comprOut << body; + return bodyStr; + }; + + Y_UNIT_TEST(TestRebuildStreamOnPost) { + const char* body = "<html>Hello</html>"; + UNIT_ASSERT(MakeHttpOutputBody(body, false) == body); + UNIT_ASSERT(MakeHttpOutputBody(body, true) == SimulateBodyEncoding(body)); } Y_UNIT_TEST(TestOutputFinish) { |