From d4e4f9064719f0461ce44cf0b0878034e8cfc514 Mon Sep 17 00:00:00 2001 From: Oguzhan Soykan Date: Mon, 22 Apr 2024 15:32:23 +0200 Subject: [PATCH] (http): assume the provided paths are encoded and pass them as is --- .../trendyol/stove/testing/e2e/http/HttpSystem.kt | 3 ++- .../stove/testing/e2e/http/HttpSystemTests.kt | 15 +++++++++++++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/lib/stove-testing-e2e-http/src/main/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystem.kt b/lib/stove-testing-e2e-http/src/main/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystem.kt index 4842a547..82c360ce 100644 --- a/lib/stove-testing-e2e-http/src/main/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystem.kt +++ b/lib/stove-testing-e2e-http/src/main/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystem.kt @@ -221,7 +221,8 @@ class HttpSystem( } @PublishedApi - internal fun relative(uri: String): Url = URLBuilder(testSystem.baseUrl).apply { path(uri) }.build() + internal fun relative(uri: String): Url = URLBuilder(testSystem.baseUrl) + .apply { appendEncodedPathSegments(uri) }.build() @PublishedApi internal fun toFormData( diff --git a/lib/stove-testing-e2e-http/src/test/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystemTests.kt b/lib/stove-testing-e2e-http/src/test/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystemTests.kt index 6fcb9fc0..0c71e560 100644 --- a/lib/stove-testing-e2e-http/src/test/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystemTests.kt +++ b/lib/stove-testing-e2e-http/src/test/kotlin/com/trendyol/stove/testing/e2e/http/HttpSystemTests.kt @@ -258,6 +258,21 @@ class HttpSystemTests : FunSpec({ } } } + + test("keep path segments as is") { + val expectedGetDtoName = UUID.randomUUID().toString() + TestSystem.validate { + wiremock { + mockGet("/get?path=1", 200, responseBody = TestDto(expectedGetDtoName).some()) + } + + http { + get("/get?path=1") { actual -> + actual.name shouldBe expectedGetDtoName + } + } + } + } }) data class TestDto(