Example usage for org.springframework.http HttpEntity hasBody

List of usage examples for org.springframework.http HttpEntity hasBody

Introduction

In this page you can find the example usage for org.springframework.http HttpEntity hasBody.

Prototype

public boolean hasBody() 

Source Link

Document

Indicates whether this entity has a body.

Usage

From source file:org.springframework.web.client.RestTemplateIntegrationTests.java

@Test
public void exchangePost() throws Exception {
    HttpHeaders requestHeaders = new HttpHeaders();
    requestHeaders.set("MyHeader", "MyValue");
    requestHeaders.setContentType(MediaType.TEXT_PLAIN);
    HttpEntity<String> requestEntity = new HttpEntity<String>(helloWorld, requestHeaders);
    HttpEntity<Void> result = template.exchange(baseUrl + "/{method}", HttpMethod.POST, requestEntity,
            Void.class, "post");
    assertEquals("Invalid location", new URI(baseUrl + "/post/1"), result.getHeaders().getLocation());
    assertFalse(result.hasBody());
}