Dirk
04/08/2022, 12:47 PMval clientTopic = HttpClient {
install(Logging)
install(ContentNegotiation) {
json()
}
install(HttpCookies) {
storage = AcceptAllCookiesStorage() // default
}
defaultRequest {
...
}
}
....
val response = clientTopic.get(href(ResourcesFormat(), ApiTopicMS.Topic.V1.Laden(onlineLinkID = onlineLinkID)))
when (response.status) {
HttpStatusCode.OK -> {
<http://console.info|console.info>("Cookies from server: ${response.setCookie()}")
val setCookieHeader = response.headers["Set-Cookie"]
<http://console.info|console.info>("Cookie from header: $setCookieHeader")
<http://console.info|console.info>(response.headers.names())
response.headers.forEach { s, strings ->
<http://console.info|console.info>("s: $strings")
}
response.body<TopicDTO>()
}
else -> {
console.error("Topic konnte nicht geladen werden. Status: ${response.status}")
null
}
}
Aleksei Tirman [JB]
04/08/2022, 2:36 PMSet-Cookie
header. You can find more information here.Dirk
04/13/2022, 12:01 PM