Examples of withHeader()


Examples of com.github.restdriver.clientdriver.ClientDriverRequest.withHeader()

    public void usingWithHeaderCanOverrideBodyContentType() {
        ClientDriverRequest request = new ClientDriverRequest("/blah").withBody("BODY", "text/plain");
       
        assertThat(request.getBodyContentType().matches("text/plain"), is(true));
       
        request.withHeader("Content-Type", "text/xml");
       
        assertThat(request.getBodyContentType().matches("text/xml"), is(true));
    }
   
    @Test
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverRequest.withHeader()

    public void usingWithHeaderCanOverrideBodyContentTypeIgnoringCase() {
        ClientDriverRequest request = new ClientDriverRequest("/blah").withBody("BODY", "text/plain");
       
        assertThat(request.getBodyContentType().matches("text/plain"), is(true));
       
        request.withHeader("content-type", "text/xml");
       
        assertThat(request.getBodyContentType().matches("text/xml"), is(true));
    }
   
    @Test
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverResponse.withHeader()

    public void usingHeaderCanOverrideContentType() {
        ClientDriverResponse response = new ClientDriverResponse("hello").withContentType("text/plain");
       
        assertThat(response.getContentType(), is("text/plain"));
       
        response.withHeader("Content-Type", "text/xml");
       
        assertThat(response.getContentType(), is("text/xml"));
    }
   
    @SuppressWarnings("deprecation")
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverResponse.withHeader()

    public void usingHeaderCanOverrideContentTypeIgnoringCase() {
        ClientDriverResponse response = new ClientDriverResponse("hello").withContentType("text/plain");
       
        assertThat(response.getContentType(), is("text/plain"));
       
        response.withHeader("content-type", "text/xml");
       
        assertThat(response.getContentType(), is("text/xml"));
    }
   
    @Test
View Full Code Here

Examples of com.github.restdriver.clientdriver.ClientDriverResponse.withHeader()

   
    @Test
    public void customHeadersCanBeSet() {
        ClientDriverResponse response = new ClientDriverResponse();
       
        response.withHeader("Server", "server-name");
       
        assertThat(response.getHeaders(), hasEntry("Server", "server-name"));
    }
   
}
View Full Code Here

Examples of org.apache.commons.csv.CSVFormat.withHeader()

        case FROM_TABLE:
            // obtain headers from table, so format should not expect a header.
            break;
        case IN_LINE:
            // an empty string array triggers csv loader to grab the first line as the header
            format = format.withHeader(new String[0]);
            break;
        case SUPPLIED_BY_USER:
            // a populated string array supplied by the user
            format = format.withHeader(columns.toArray(new String[columns.size()]));
            break;
View Full Code Here

Examples of org.apache.commons.csv.CSVFormat.withHeader()

            // an empty string array triggers csv loader to grab the first line as the header
            format = format.withHeader(new String[0]);
            break;
        case SUPPLIED_BY_USER:
            // a populated string array supplied by the user
            format = format.withHeader(columns.toArray(new String[columns.size()]));
            break;
        default:
            throw new RuntimeException("Header source was unable to be inferred.");

        }
View Full Code Here

Examples of org.apache.isis.viewer.json.applib.RestfulRequest.withHeader()

    @Test
    public void correctMediaType() throws Exception {

        // given
        final RestfulRequest restfulReq = client.createRequest(HttpMethod.GET, "/");
        restfulReq.withHeader(Header.ACCEPT, MediaType.APPLICATION_JSON_TYPE);

        // when
        final RestfulResponse<HomePageRepresentation> restfulResp = restfulReq.executeT();

        // then
View Full Code Here

Examples of org.apache.isis.viewer.json.applib.RestfulRequest.withHeader()

    public void runtimeException_isMapped() throws Exception {

        // given
        final RestfulRequest restfulReq = client.createRequest(HttpMethod.GET, "version");
        final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
        restfulReq.withHeader(header, true);

        // when
        final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();

        // then
View Full Code Here

Examples of org.apache.isis.viewer.restfulobjects.applib.client.RestfulRequest.withHeader()

    public void runtimeException_isMapped() throws Exception {

        // given
        final RestfulRequest restfulReq = client.createRequest(RestfulHttpMethod.GET, "version");
        final Header<Boolean> header = new Header<Boolean>("X-FAIL", Parser.forBoolean());
        restfulReq.withHeader(header, true);

        // when
        final RestfulResponse<JsonRepresentation> jsonResp = restfulReq.execute();

        // then
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.