TEST_P(DownstreamProtocolIntegrationTest, ContentLengthSmallerThanPayload) {
  initialize();
  codec_client_ = makeHttpConnection(lookupPort("http"));
  auto response =
      codec_client_->makeRequestWithBody(Http::TestRequestHeaderMapImpl{{":method", "POST"},
                                                                        {":path", "/test/long/url"},
                                                                        {":scheme", "http"},
                                                                        {":authority", "host"},
                                                                        {"content-length", "123"}},
                                         1024);
  if (downstreamProtocol() == Http::CodecType::HTTP1) {
    waitForNextUpstreamRequest();
    // HTTP/1.x requests get the payload length from Content-Length header. The remaining bytes is
    // parsed as another request.
    EXPECT_EQ(123u, upstream_request_->body().length());
    upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, true);
    ASSERT_TRUE(response->waitForEndStream());
    EXPECT_EQ("200", response->headers().getStatusValue());
    EXPECT_TRUE(response->complete());
  } else {
    // Inconsistency in content-length header and the actually body length should be treated as a
    // stream error.
    ASSERT_TRUE(response->waitForReset());
    EXPECT_EQ(Http::StreamResetReason::RemoteReset, response->resetReason());
  }
}
TEST_P(DownstreamProtocolIntegrationTest, ContentLengthSmallerThanPayload) {
  initialize();
  codec_client_ = makeHttpConnection(lookupPort("http"));
  auto response =
      codec_client_->makeRequestWithBody(Http::TestRequestHeaderMapImpl{{":method", "POST"},
                                                                        {":path", "/test/long/url"},
                                                                        {":scheme", "http"},
                                                                        {":authority", "host"},
                                                                        {"content-length", "123"}},
                                         1024);
  if (downstreamProtocol() == Http::CodecType::HTTP1) {
    waitForNextUpstreamRequest();
     
     
    EXPECT_EQ(123u, upstream_request_->body().length());
    upstream_request_->encodeHeaders(Http::TestResponseHeaderMapImpl{{":status", "200"}}, true);
    ASSERT_TRUE(response->waitForEndStream());
    EXPECT_EQ("200", response->headers().getStatusValue());
    EXPECT_TRUE(response->complete());
  } else {
     
     
    ASSERT_TRUE(response->waitForReset());
    EXPECT_EQ(Http::StreamResetReason::RemoteReset, response->resetReason());
  }
}