use of io.restassured.builder.RequestSpecBuilder in project rest-assured by rest-assured.
the class FilterITest method defaultFiltersDontAccumluate.
/**
* Regression Test for 197
*/
@Test
public void defaultFiltersDontAccumluate() {
CountingFilter myFilter = new CountingFilter();
try {
RestAssured.config = RestAssuredConfig.newConfig();
RestAssured.filters(myFilter);
RequestSpecification spec = new RequestSpecBuilder().build();
given().get("/greetJSON?firstName=John&lastName=Doe");
assertThat(myFilter.counter, equalTo(1));
given().spec(spec).get("/greetJSON?firstName=Johan&lastName=Doe");
assertThat(myFilter.counter, equalTo(2));
} finally {
RestAssured.reset();
}
}
use of io.restassured.builder.RequestSpecBuilder 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.builder.RequestSpecBuilder 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.builder.RequestSpecBuilder 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.builder.RequestSpecBuilder 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");
}
Aggregations