Skip to content

Commit

Permalink
(http): assume the provided paths are encoded and pass them as is
Browse files Browse the repository at this point in the history
  • Loading branch information
osoykan committed Apr 22, 2024
1 parent 9123a05 commit d4e4f90
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<TestDto>("/get?path=1") { actual ->
actual.name shouldBe expectedGetDtoName
}
}
}
}
})

data class TestDto(
Expand Down

0 comments on commit d4e4f90

Please sign in to comment.