use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingMultiValueQueryParametersWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingMultiValueQueryParametersWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addQueryParam("list", "1", "2", "3").build();
given().spec(spec).expect().body("list", equalTo("1,2,3")).when().get("/multiValueParam");
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class SpecificationBuilderITest method supportsMergingHeadersWhenUsingRequestSpecBuilder.
@Test
public void supportsMergingHeadersWhenUsingRequestSpecBuilder() throws Exception {
final RequestSpecification spec = new RequestSpecBuilder().addHeader("header1", "value1").build();
given().spec(spec).header("header2", "value2").expect().body(containsString("header1")).body(containsString("header2")).when().get("/header");
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class URLEncodingITest method urlEncodingDisabledUsingRequestSpecBuilder.
@Test
@Ignore("2.0.alpha1 no longer working")
public void urlEncodingDisabledUsingRequestSpecBuilder() {
final RequestSpecification specification = new RequestSpecBuilder().setUrlEncodingEnabled(false).build();
final String body = given().specification(specification).get("https://jira.atlassian.com:443/rest/api/2.0.alpha1/search?jql=project%20=%20BAM%20AND%20issuetype%20=%20Bug").asString();
assertThat(body, containsString("issues"));
}
use of io.restassured.specification.RequestSpecification in project rest-assured by rest-assured.
the class MultiPartUploadITest method bytesAndFormParamUploadingWorkUsingRequestBuilder.
@Test
public void bytesAndFormParamUploadingWorkUsingRequestBuilder() throws Exception {
final byte[] bytes = IOUtils.toByteArray(getClass().getResourceAsStream("/car-records.xsd"));
final RequestSpecification spec = new RequestSpecBuilder().addMultiPart("file", "myFile", bytes).addFormParam("text", "Some text").build();
// When
given().spec(spec).expect().body(is(new String(bytes) + "Some text")).when().post("/multipart/fileAndText");
}
use of io.restassured.specification.RequestSpecification 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();
}
}
Aggregations