From 435674ca8a314cbeb4fb6aa15ecc74d6eec4b54f Mon Sep 17 00:00:00 2001 From: Ryan Bergman Date: Wed, 24 Apr 2024 15:48:53 -0500 Subject: [PATCH] add test for options --- .../kong/unirest/core/RequestFactoryTest.java | 21 ++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/unirest/src/test/java/kong/unirest/core/RequestFactoryTest.java b/unirest/src/test/java/kong/unirest/core/RequestFactoryTest.java index 6d72adf2..0c3cadd8 100644 --- a/unirest/src/test/java/kong/unirest/core/RequestFactoryTest.java +++ b/unirest/src/test/java/kong/unirest/core/RequestFactoryTest.java @@ -1,6 +1,5 @@ package kong.unirest.core; -import kong.unirest.core.json.JSONObject; import org.assertj.core.api.AbstractAssert; import org.junit.jupiter.api.Test; @@ -47,6 +46,26 @@ void copy_get() { .hasTimeout(timeout); } + @Test + void copy_options() { + var req = Unirest.options(url) + .header(headerKey, headerValue) + .queryString(queryKey, queryValue) + .downloadMonitor(downloadMonitor) + .withObjectMapper(om) + .connectTimeout(timeout); + + var copy = RequestFactory.copy(req); + + assertRequest(copy) + .isInstanceOf(HttpRequestNoBody.class) + .hasHeader(headerKey, headerValue) + .hasRoute(HttpMethod.OPTIONS, urlWithQuery) + .downloadMonitorIs(downloadMonitor) + .objectMapperIs(om) + .hasTimeout(timeout); + } + @Test void copy_head() { var req = Unirest.head(url)