Skip to content

Commit

Permalink
Add HttpWaitStrategy#withMethod (#3533)
Browse files Browse the repository at this point in the history
  • Loading branch information
xaviarias authored Dec 10, 2020
1 parent d60d490 commit 1b2d228
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ public class HttpWaitStrategy extends AbstractWaitStrategy {
private static final String AUTH_BASIC = "Basic ";

private String path = "/";
private String method = "GET";
private Set<Integer> statusCodes = new HashSet<>();
private boolean tlsEnabled;
private String username;
Expand Down Expand Up @@ -97,6 +98,17 @@ public HttpWaitStrategy usingTls() {
return this;
}

/**
* Indicates the HTTP method to use (<code>GET</code> by default).
*
* @param method the HTTP method.
* @return this
*/
public HttpWaitStrategy withMethod(String method) {
this.method = method;
return this;
}

/**
* Authenticate with HTTP Basic Authorization credentials.
*
Expand Down Expand Up @@ -167,7 +179,7 @@ protected void waitUntilReady() {
connection.setUseCaches(false);
}

connection.setRequestMethod("GET");
connection.setRequestMethod(method);
connection.connect();

log.trace("Get response code {}", connection.getResponseCode());
Expand Down

0 comments on commit 1b2d228

Please sign in to comment.