Added an option to bufferontent for WireMockRestServiceServer
fixes gh-860
This commit is contained in:
@@ -83,6 +83,8 @@ public final class WireMockRestServiceServer {
|
||||
|
||||
private String baseUrl = "";
|
||||
|
||||
private boolean bufferContent = false;
|
||||
|
||||
private MockRestServiceServerBuilder builder;
|
||||
|
||||
private List<String> locations = new ArrayList<String>();
|
||||
@@ -116,6 +118,15 @@ public final class WireMockRestServiceServer {
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Flag to tell the server to buffer the contents of the response.
|
||||
* @return this
|
||||
*/
|
||||
public WireMockRestServiceServer bufferContent() {
|
||||
this.bufferContent = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* If stub locations are given as a directory, then we search recursively in that
|
||||
* directory for files with this suffix. Default is ".json".
|
||||
@@ -180,6 +191,9 @@ public final class WireMockRestServiceServer {
|
||||
if (this.ignoreExpectOrder) {
|
||||
this.builder.ignoreExpectOrder(true); // default is false
|
||||
}
|
||||
if (this.bufferContent) {
|
||||
this.builder.bufferContent();
|
||||
}
|
||||
MockRestServiceServer server = this.builder.build();
|
||||
List<StubMapping> mappings = new ArrayList<>();
|
||||
for (String location : this.locations) {
|
||||
|
||||
Reference in New Issue
Block a user