Search in sources :

Example 1 with DecoderConfig

use of io.restassured.config.DecoderConfig in project rest-assured by rest-assured.

the class DecoderConfigITest method filters_can_change_content_decoders.

@Test
public void filters_can_change_content_decoders() {
    given().config(RestAssuredConfig.newConfig().decoderConfig(DecoderConfig.decoderConfig().contentDecoders(DecoderConfig.ContentDecoder.GZIP, DecoderConfig.ContentDecoder.DEFLATE))).filter((requestSpec, responseSpec, ctx) -> {
        final RestAssuredConfig config1 = requestSpec.getConfig();
        assertThat(config1.getDecoderConfig().contentDecoders(), Matchers.contains(DecoderConfig.ContentDecoder.GZIP, DecoderConfig.ContentDecoder.DEFLATE));
        requestSpec.config(config1.decoderConfig(new DecoderConfig(DecoderConfig.ContentDecoder.DEFLATE)));
        return ctx.next(requestSpec, responseSpec);
    }).expect().body("Accept-Encoding", contains("deflate")).when().get("/headersWithValues");
}
Also used : RestAssuredConfig(io.restassured.config.RestAssuredConfig) DecoderConfig(io.restassured.config.DecoderConfig) Test(org.junit.Test)

Aggregations

DecoderConfig (io.restassured.config.DecoderConfig)1 RestAssuredConfig (io.restassured.config.RestAssuredConfig)1 Test (org.junit.Test)1