use of io.cucumber.core.options.CurlOption in project cucumber-jvm by cucumber.
the class UrlOutputStreamTest method streams_request_body_in_chunks.
@Test
void streams_request_body_in_chunks(Vertx vertx, VertxTestContext testContext) {
String requestBody = makeOneKilobyteStringWithEmoji();
TestServer testServer = new TestServer(port, testContext, requestBody, HttpMethod.PUT, null, null, 200, "");
CurlOption url = CurlOption.parse(format("http://localhost:%d", port));
verifyRequest(url, testServer, vertx, testContext, requestBody);
}
use of io.cucumber.core.options.CurlOption in project cucumber-jvm by cucumber.
the class UrlOutputStreamTest method it_sends_the_body_once_for_202_and_location_with_get_without_token.
@Test
void it_sends_the_body_once_for_202_and_location_with_get_without_token(Vertx vertx, VertxTestContext testContext) throws Exception {
String requestBody = "hello";
TestServer testServer = new TestServer(port, testContext, requestBody, HttpMethod.PUT, null, null, 200, "");
CurlOption url = CurlOption.parse(format("http://localhost:%d/accept -X GET -H 'Authorization: Bearer s3cr3t'", port));
verifyRequest(url, testServer, vertx, testContext, requestBody);
assertThat(testContext.awaitCompletion(TIMEOUT_SECONDS, TimeUnit.SECONDS), is(true));
if (exception != null) {
throw exception;
}
assertThat(testServer.receivedBody.toString("utf-8"), is(equalTo(requestBody)));
}
use of io.cucumber.core.options.CurlOption in project cucumber-jvm by cucumber.
the class UrlOutputStreamTest method overrides_request_method.
@Test
void overrides_request_method(Vertx vertx, VertxTestContext testContext) {
String requestBody = "hello";
TestServer testServer = new TestServer(port, testContext, requestBody, HttpMethod.POST, null, "application/x-www-form-urlencoded", 200, "");
CurlOption url = CurlOption.parse(format("http://localhost:%d -X POST", port));
verifyRequest(url, testServer, vertx, testContext, requestBody);
}
use of io.cucumber.core.options.CurlOption in project cucumber-jvm by cucumber.
the class UrlOutputStreamTest method throws_exception_for_307_temporary_redirect_without_location.
@Test
@Disabled
void throws_exception_for_307_temporary_redirect_without_location(Vertx vertx, VertxTestContext testContext) throws InterruptedException {
String requestBody = "hello";
TestServer testServer = new TestServer(port, testContext, requestBody, HttpMethod.POST, null, "application/x-www-form-urlencoded", 200, "");
CurlOption url = CurlOption.parse(format("http://localhost:%d/redirect-no-location -X POST", port));
verifyRequest(url, testServer, vertx, testContext, requestBody);
assertThat(testContext.awaitCompletion(TIMEOUT_SECONDS, TimeUnit.SECONDS), is(true));
assertThat(exception.getMessage(), equalTo("HTTP request failed:\n" + "> POST http://localhost:" + port + "/redirect-no-location\n" + "< HTTP/1.1 307 Temporary Redirect\n" + "< content-length: 0\n"));
}
use of io.cucumber.core.options.CurlOption in project cucumber-jvm by cucumber.
the class UrlOutputStreamTest method sets_request_headers.
@Test
void sets_request_headers(Vertx vertx, VertxTestContext testContext) {
String requestBody = "hello";
TestServer testServer = new TestServer(port, testContext, requestBody, HttpMethod.PUT, "foo=bar", "application/x-ndjson", 200, "");
CurlOption url = CurlOption.parse(format("http://localhost:%d?foo=bar -H 'Content-Type: application/x-ndjson'", port));
verifyRequest(url, testServer, vertx, testContext, requestBody);
}
Aggregations