Example usage for org.springframework.restdocs.operation OperationResponse getHeaders

List of usage examples for org.springframework.restdocs.operation OperationResponse getHeaders

Introduction

In this page you can find the example usage for org.springframework.restdocs.operation OperationResponse getHeaders.

Prototype

HttpHeaders getHeaders();

Source Link

Document

Returns the headers in the response.

Usage

From source file:io.github.restdocsext.jersey.JerseyResponseConverterTest.java

@Test
public void convers_response() {
    final ClientResponse clientResponse = Mocks.clientResponseBuilder().status(200)
            .header("X-Response-Header1", "SomeValue1").header("X-Response-Header2", "SomeValue2")
            .requestContext(Mocks.clientRequestBuilder()
                    .configProp(RESPONSE_BODY_KEY, "Testing".getBytes(StandardCharsets.UTF_8)).build())
            .build();/* w  w  w  .j a  v a  2s.c om*/
    final OperationResponse response = new JerseyResponseConverter().convert(clientResponse);
    assertThat(response.getContentAsString(), is("Testing"));
    assertThat(response.getStatus().value(), is(200));
    assertThat(response.getHeaders().getFirst("X-Response-Header1"), is("SomeValue1"));
    assertThat(response.getHeaders().getFirst("X-Response-Header2"), is("SomeValue2"));
}