69 bool isResponseChunked = originalResponseBody->
isChained();
73 if (isResponseChunked && expectCompression) {
90 if (expectCompression) {
104 if (isResponseChunked) {
114 std::unique_ptr<folly::IOBuf> responseBody;
117 .WillRepeatedly(
DoAll(
118 Invoke([&](std::shared_ptr<folly::IOBuf> body) {
120 std::unique_ptr<folly::IOBuf> processedBody;
122 if (expectCompression) {
123 processedBody =
zd_->decompress(body.get());
125 <<
"Failed to decompress body. r=" <<
zd_->getStatus();
128 body->data(), body->length(), 0, 0);
147 std::set<std::string> compressibleTypes = {
"text/html"};
148 auto filterFactory = std::make_unique<ZlibServerFilterFactory>(
149 compressionLevel, minimumCompressionSize, compressibleTypes);
159 if (isResponseChunked) {
167 crtBuf = originalResponseBody.get();
171 crtBuf = crtBuf->
next();
172 }
while (crtBuf != originalResponseBody.get());
186 filter->requestComplete();
188 EXPECT_THAT(responseBody, IOBufEquals(originalRequestBody));
ResponseBuilder & status(uint16_t code, const std::string &message)
PUSHMI_INLINE_VAR constexpr detail::filter_fn filter
constexpr detail::Map< Move > move
std::unique_ptr< IOBuf > clone() const
size_t countChainElements() const
ResponseBuilder & body(std::unique_ptr< folly::IOBuf > bodyIn)
ResponseHandler * downstream_
std::unique_ptr< ZlibStreamDecompressor > zd_
bool checkForHeaderToken(const HTTPHeaderCode headerCode, char const *token, bool caseSensitive) const
bool getIsChunked() const
PolymorphicAction< internal::InvokeAction< FunctionImpl > > Invoke(FunctionImpl function_impl)
ResponseBuilder & header(const std::string &headerIn, const T &value)
MockRequestHandler * requestHandler_
ssize_t send(NetworkSocket s, const void *buf, size_t len, int flags)
std::unique_ptr< IOBuf > cloneOne() const
HTTPHeaders & getHeaders()
std::unique_ptr< MockResponseHandler > responseHandler_
void prependChain(std::unique_ptr< IOBuf > &&iobuf)
#define EXPECT_TRUE(condition)
#define EXPECT_THAT(value, matcher)
internal::DoBothAction< Action1, Action2 > DoAll(Action1 a1, Action2 a2)
#define EXPECT_CALL(obj, call)
const internal::AnythingMatcher _
#define ASSERT_FALSE(condition)
#define EXPECT_FALSE(condition)
static std::unique_ptr< IOBuf > copyBuffer(const void *buf, std::size_t size, std::size_t headroom=0, std::size_t minTailroom=0)
internal::ReturnAction< R > Return(R value)