From 9ac2182d08e304e175c273d514c7993a190954e8 Mon Sep 17 00:00:00 2001 From: dzikoysk Date: Mon, 19 Aug 2024 21:26:31 +0200 Subject: [PATCH] GH-2197 Update base path test playground --- .../com/reposilite/web/BasePathIntegrationTest.kt | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/reposilite-backend/src/integration/kotlin/com/reposilite/web/BasePathIntegrationTest.kt b/reposilite-backend/src/integration/kotlin/com/reposilite/web/BasePathIntegrationTest.kt index ad4de9d74..bd56b2dfa 100644 --- a/reposilite-backend/src/integration/kotlin/com/reposilite/web/BasePathIntegrationTest.kt +++ b/reposilite-backend/src/integration/kotlin/com/reposilite/web/BasePathIntegrationTest.kt @@ -14,6 +14,8 @@ * limitations under the License. */ +@file:Suppress("FunctionName") + package com.reposilite.web import com.reposilite.RecommendedLocalSpecificationJunitExtension @@ -65,13 +67,18 @@ internal class BasePathIntegrationTest : ReposiliteSpecification() { .delete("$basePath/") { Unirest.delete(it.reposiliteLocation()).redirect(it) } .options("$basePath/") { Unirest.options(it.reposiliteLocation()).redirect(it) } .get("/stop") { await.countDown() } - .start(80) + .start(8080) await.await() } + private val restrictedHttpHeaders = listOf( + "Connection", + "Host", + ) + private fun > R.redirect(ctx: Context) { - ctx.headerMap().forEach { (key, value) -> header(key, value) } + ctx.headerMap().filter { it.key !in restrictedHttpHeaders }.forEach { (key, value) -> header(key, value) } val response = this.asBytes() response.headers.all().forEach { ctx.header(it.name, it.value) } ctx.status(response.status).result(response.body)