Skip to content

Commit

Permalink
--Added new cukes option 'follow_redirects'
Browse files Browse the repository at this point in the history
--Added new method shutDownAllServers() to MockClientServerFacade that stops all mock services
--Added @InflateContext to lv.ctco.cukes.rest.api.WhenSteps
  • Loading branch information
Alexey Voroncov committed Oct 23, 2018
1 parent cd61e2e commit 85f2256
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 2 additions & 0 deletions cukes-core/src/main/java/lv/ctco/cukes/core/CukesOptions.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,4 +33,6 @@ public interface CukesOptions {
String CONTEXT_INFLATING_ENABLED = "context_inflating_enabled";
String ASSERTIONS_DISABLED = "assertions_disabled";
String LOADRUNNER_FILTER_BLOCKS_REQUESTS = "loadrunner_filter_blocks_requests";

String FOLLOW_REDIRECTS = "follow_redirects";
}
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,8 @@ public void stopAllServers() {
public void resetAllServers() {
// servers.reset();
}

public void shutDownAllServers() {
servers.values().forEach(server -> server.stop(true));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import static io.restassured.config.DecoderConfig.ContentDecoder.DEFLATE;
import static io.restassured.config.DecoderConfig.decoderConfig;
import static io.restassured.config.JsonConfig.jsonConfig;
import static io.restassured.config.RedirectConfig.redirectConfig;
import static io.restassured.config.RestAssuredConfig.newConfig;

@Singleton
Expand All @@ -29,7 +30,8 @@ public RestAssuredConfig getConfig() {
}

private RestAssuredConfig buildRestAssuredConfig() {
RestAssuredConfig config = newConfig().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.BIG_DECIMAL));
RestAssuredConfig config = newConfig().jsonConfig(jsonConfig().numberReturnType(JsonPathConfig.NumberReturnType.BIG_DECIMAL))
.redirect(redirectConfig().followRedirects(world.getBoolean(CukesOptions.FOLLOW_REDIRECTS, true)));
if (!world.getBoolean(CukesOptions.GZIP_SUPPORT, true)) {
config.decoderConfig(decoderConfig().contentDecoders(DEFLATE));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@
import com.google.inject.Inject;
import com.google.inject.Singleton;
import cucumber.api.java.en.When;
import lv.ctco.cukes.core.internal.context.InflateContext;
import lv.ctco.cukes.http.facade.HttpResponseFacade;

@Singleton
@InflateContext
public class WhenSteps {

@Inject
Expand Down

0 comments on commit 85f2256

Please sign in to comment.