use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class HeaderConfigITest method request_spec_overwrites_headers_when_configured_in_header_config.
@Test
public void request_spec_overwrites_headers_when_configured_in_header_config() {
RequestSpecification specification = new RequestSpecBuilder().addHeader("header1", "value2").build();
List<Header> list = given().config(RestAssuredConfig.config().headerConfig(HeaderConfig.headerConfig().overwriteHeadersWithName("header1"))).header("header1", "value1").spec(specification).when().get("/multiHeaderReflect").then().extract().headers().getList("header1");
assertThat(list, hasSize(1));
assertThat(list.get(0).getValue(), equalTo("value2"));
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class HeaderConfigITest method request_spec_merges_headers_by_default.
@Test
public void request_spec_merges_headers_by_default() {
RequestSpecification specification = new RequestSpecBuilder().addHeader("header1", "value2").build();
List<Header> list = given().header("header1", "value1").spec(specification).when().get("/multiHeaderReflect").then().extract().headers().getList("header1");
assertThat(list, hasSize(2));
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class SSLITest method supports_overriding_truststore_in_request_specification.
@Test
public void supports_overriding_truststore_in_request_specification() {
final RequestSpecification spec = new RequestSpecBuilder().setTrustStore("/jetty_localhost_client.jks", "wrong pw").build();
RestAssured.given().spec(spec).trustStore("/jetty_localhost_client.jks", "test1234").expect().spec(helloWorldSpec()).when().get("https://localhost:8443/hello");
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class SSLITest method supports_setting_truststore_in_request_specification.
@Test
public void supports_setting_truststore_in_request_specification() {
final RequestSpecification spec = new RequestSpecBuilder().setTrustStore("/jetty_localhost_client.jks", "test1234").build();
RestAssured.given().spec(spec).expect().spec(helloWorldSpec()).when().get("https://localhost:8443/hello");
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingRequestSpecHeadersUsingTheBuilder.
@Test
public void supportsMergingRequestSpecHeadersUsingTheBuilder() throws Exception {
final RequestSpecification spec = given().header("header2", "value2");
final RequestSpecification spec2 = new RequestSpecBuilder().addHeader("header1", "value1").addRequestSpecification(spec).build();
given().spec(spec2).header("header3", "value3").expect().body(containsString("header1")).body(containsString("header2")).body(containsString("header3")).when().get("/header");
}
Aggregations