hi, we have a ktor http client trying to post to a ktor server with cookies. the server isn’t seeing any
request.cookies[]
, anyone have any idea why? setup in thread
Justin Moy
04/14/2021, 9:26 PM
Copy code
val httpClient = HttpClient {
install(HttpCookies) {
storage = AcceptAllCookiesStorage()
}
}
with(httpClient) {
post<HttpResponse>(appUrl) {
// none of these methods work
//headers.append("Cookie", "${appCookie.name}=${appCookie.value};")
//headers.set("Cookie", "${appCookie.name}=${appCookie.value};")
//header("Cookie", "${appCookie.name}=${appCookie.value};")
headers.appendAll(Headers.build { //this also does NOT work
append("Cookie", "${appCookie.name}=${appCookie.value};")
})
body = TextContent(bodyAsString, ContentType.Application.Json)
}
}
Justin Moy
04/15/2021, 4:21 PM
nevermind, we figured it was how we were creating our client