diff --git a/core/src/test/kotlin/com/hexagonkt/core/media/MediaTypesTest.kt b/core/src/test/kotlin/com/hexagonkt/core/media/MediaTypesTest.kt index 83dd48f9e7..f3d0fce84c 100644 --- a/core/src/test/kotlin/com/hexagonkt/core/media/MediaTypesTest.kt +++ b/core/src/test/kotlin/com/hexagonkt/core/media/MediaTypesTest.kt @@ -23,9 +23,9 @@ internal class MediaTypesTest { @Test fun `Parse correct media types`() { MediaType("*/*").apply { assertEquals(ANY, group) + assertEquals("any", group.text) assertEquals("*", type) assertEquals("*/*", fullType) - } MediaType("text/plain").apply { diff --git a/http/http/src/test/kotlin/com/hexagonkt/http/HttpTest.kt b/http/http/src/test/kotlin/com/hexagonkt/http/HttpTest.kt index 0fa0e3afa3..15e6f61669 100644 --- a/http/http/src/test/kotlin/com/hexagonkt/http/HttpTest.kt +++ b/http/http/src/test/kotlin/com/hexagonkt/http/HttpTest.kt @@ -14,6 +14,16 @@ import kotlin.test.assertTrue internal class HttpTest { + @Test fun `Format query string with empty keys`() { + assertEquals("", formatQueryString(QueryParameters(QueryParameter("", 1)))) + assertEquals("", formatQueryString(QueryParameters(QueryParameter(" ", 1)))) + } + + @Test fun `Basic auth is encoded correctly`() { + assertEquals("YTo", basicAuth("a")) + assertEquals("YTpi", basicAuth("a", "b")) + } + @Test fun `Format query string`() { fun testParseFormat(expected: String, queryString: String) { assertEquals(expected, formatQueryString(parseQueryString(queryString))) diff --git a/http/http/src/test/kotlin/com/hexagonkt/http/model/CookieTest.kt b/http/http/src/test/kotlin/com/hexagonkt/http/model/CookieTest.kt index c810b70268..213285dc0f 100644 --- a/http/http/src/test/kotlin/com/hexagonkt/http/model/CookieTest.kt +++ b/http/http/src/test/kotlin/com/hexagonkt/http/model/CookieTest.kt @@ -1,5 +1,6 @@ package com.hexagonkt.http.model +import com.hexagonkt.http.model.CookieSameSite.* import org.junit.jupiter.api.Assertions.assertFalse import org.junit.jupiter.api.Test import kotlin.IllegalArgumentException @@ -20,6 +21,10 @@ internal class CookieTest { assertEquals(5, cookie.maxAge) assertTrue(cookie.secure) assertFalse(cookie.deleted) + + assertEquals(LAX, cookie.copy(sameSite = LAX).sameSite) + assertEquals(NONE, cookie.copy(sameSite = NONE).sameSite) + assertEquals(STRICT, cookie.copy(sameSite = STRICT).sameSite) } @Test fun `Cookie can be deleted`() {