Example usage for org.apache.http.client.methods HttpPatch getEntity

List of usage examples for org.apache.http.client.methods HttpPatch getEntity

Introduction

In this page you can find the example usage for org.apache.http.client.methods HttpPatch getEntity.

Prototype

public HttpEntity getEntity() 

Source Link

Usage

From source file:org.fcrepo.client.utils.HttpHelperTest.java

@Test
public void testCreatePatchMethod() throws Exception {
    final String sparql = "test sparql command";
    final HttpPatch patch = helper.createPatchMethod("/foo", sparql);
    assertEquals(repoURL + "/foo", patch.getURI().toString());
    assertEquals("application/sparql-update", patch.getFirstHeader("Content-Type").getValue());
    assertEquals(sparql, IOUtils.toString(patch.getEntity().getContent()));
}

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

@Test
public void pathRequestBuiltWithBody() {
    setupContext();/*from   w  w  w.ja  v  a2s .  c o  m*/
    InputStreamEntity inputStreamEntity = new InputStreamEntity(new ByteArrayInputStream(new byte[] { 1 }));
    HttpRequest httpRequest = getFilter().buildHttpRequest("PATCH", "uri", inputStreamEntity,
            new LinkedMultiValueMap<>(), new LinkedMultiValueMap<>(), new MockHttpServletRequest());

    HttpPatch basicHttpRequest = (HttpPatch) httpRequest;
    assertTrue(basicHttpRequest.getEntity() != null);
}