Example usage for org.apache.http.entity InputStreamEntity InputStreamEntity

List of usage examples for org.apache.http.entity InputStreamEntity InputStreamEntity

Introduction

In this page you can find the example usage for org.apache.http.entity InputStreamEntity InputStreamEntity.

Prototype

public InputStreamEntity(InputStream inputStream) 

Source Link

Usage

From source file:org.springframework.cloud.netflix.zuul.filters.route.SimpleHostRoutingFilterTests.java

@Test
public void httpClientPreservesUnencodedData() throws Exception {
    setupContext();/*  w  ww .j av a2s. c o  m*/
    InputStreamEntity inputStreamEntity = new InputStreamEntity(new ByteArrayInputStream(new byte[] { 1 }));
    HttpRequest httpRequest = getFilter().buildHttpRequest("GET", "/app/get/1", inputStreamEntity,
            new LinkedMultiValueMap<>(), new LinkedMultiValueMap<>(), new MockHttpServletRequest());

    CloseableHttpResponse response = getFilter().newClient().execute(new HttpHost("localhost", this.port),
            httpRequest);
    assertEquals(200, response.getStatusLine().getStatusCode());
    String responseString = copyToString(response.getEntity().getContent(), Charset.forName("UTF-8"));
    assertTrue("Get 1".equals(responseString));
}