https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
ktor
  • f

    FunkyMuse

    05/29/2022, 3:17 PM
    Hey guys, I have avatar folder, for each user i create a folder with his unique username /users/{username} ^ external folder Inside that folder I have avatar.jpg When I access the image via serverUrl/users/admin/avatar.jpg It says that the image cannot be displayed. How do I set this up for each user?
    b
    • 2
    • 25
  • a

    Arjan van Wieringen

    05/30/2022, 6:20 PM
    Maybe I am overlooking things, but i want to make a simple request using the Ktor Client in JS to https://xkcd.com/info.0.json However, the xkcd server doesn't have CORS enabled and as such Chrome is blocking it. But I can't find how to set
    mode
    to
    no-cors
    for Ktor Client in JS.
    a
    • 2
    • 7
  • n

    napperley

    05/31/2022, 1:49 AM
    Below are my initial impressions on the Native version of Ktor Server (for the linuxX64 target): 1. Web server starts up extremely quickly (0.0s) 😆 2. After exiting an application using Ktor Server (via Ctrl+c) there is a long delay before the address is freed ☹️ 3. Missing documentation on the dependencies that the Native version of Ktor Server uses (C libs used, what libs are statically/dynamically linked, linker/compiler options used etc) 4. All the text streams (stdout, stderr and stdin) are hijacked by the Web Engine, which makes it impossible to do process forking 5. The learning curve of the Native version of Ktor Server (no manual linking 🎉) is at a similar level to the JVM version 😄 6. Missing Ktor Server versions for the Kotlin Native Linux ARM targets 7. There are some cases where a response from the server should be in a completed state, but ends up in an infinite loop scenario (aka the web page on the client side is taking forever to load) 8. Low memory usage around 8.8 MB for a Hello World type application
    🎉 2
    e
    • 2
    • 2
  • m

    Muhammad Usman

    05/31/2022, 11:44 AM
    Hi Can anyone tell me how to include a dir inside the project root dir into ShadowJar plugin's resultant jar file. For example i want to include credentials dir in final output jar, following code does not work
    tasks {
        named<ShadowJar>("shadowJar") {
             include("credentials/")
            exclude("department_images/")
            exclude("json/")
            exclude("question_images/")
    
        }
    }
    b
    • 2
    • 1
  • n

    natario1

    05/31/2022, 6:47 PM
    We’ve been using
    defaultRequest { }
    to configure the base URL for our backend, like https://backend.com , then do things like
    get("users")
    . If the base url has a segment though, like https://backend.com/v1 . v1 is ignored in
    get("users")
    will still hit https://backend.com/users. I kind of get why this happens but is there any way to make it work?
    e
    r
    • 3
    • 4
  • j

    jeggy

    05/31/2022, 9:10 PM
    Is it possible for community ktor plugins to get listed in the ktor project wizard?
    👍 4
    a
    • 2
    • 1
  • b

    bitkid

    06/01/2022, 12:05 PM
    hi! i am currently updating to ktor2 and i am moving from the location API to the resource API. in my URL parameters i used to have a parameter defined like this val format: ImportFormat = ImportFormat.NDJSONLD (where import format is an enum). it was possible to omit the enum parameter in the location API and it just took the default value. now i get the exception Can't transform call to resource with an underlying NPE. any ideas?
    r
    • 2
    • 15
  • m

    martinm

    06/02/2022, 7:45 AM
    heyhey, I am trying to create a Ktor server plugin where I want to set a custom coroutine context (
    withContext
    ), that should be used when handling requests. (I want to create an active span with opentelemetry-extension-kotlin that is tied to the coroutine context). Looking through the examples I can only see before and after hooks, but nothing like an around interceptor. Any ideas?
    a
    • 2
    • 3
  • d

    doyaaaaaaken

    06/02/2022, 8:04 AM
    Hi, I’m currently upgrading my project to ktor2. I use [
    CachingHeader
    plugin](https://ktor.io/docs/caching.html), and
    CachingOptions
    (io.ktor.server.http.content) class shows compile errors because it became to need
    expires
    parameter (non nullable). As I know, If we want to return
    Cache-Control: no-cache
    as http response, then
    expires
    header is not required. Why is this parameter required?
    a
    • 2
    • 2
  • b

    bitkid

    06/02/2022, 8:47 AM
    i am seeing a strange issue with ktor 2.0.2 (does not happen in 2.0.1). i have an endpoint which returns a pretty printed json (call.respond(thePrettyString)) and i debug it to the console before sending it and it looks fine ... then in the test i do testApplication { client.get("/json").bodyAsText() } ... and write it to the console .. and suddenly it looks like this
    "{\r\n  \"swagger\" : \"2.0\",\r\n  \"info\" : {\r\n    \"description\" : \"Talks to AD and handles permissions\",\r\n
    r
    • 2
    • 2
  • c

    Claude Brisson

    06/02/2022, 9:33 AM
    Can I ask what is the point of having ApplicationConfiguration and ApplicationConfigurationValue wrappers around typesafe objects? They remove access to several other data types, and also to any mechanism of introspection. If I have, for instance, a tier library which expects a Map for its configuration, and if I want to configure it from its own section in application.conf, then I have to do it manually, key/value by key/value... If I want later to add a new configuration parameter, then I'll have to add it both in application.conf and in the conf... My opinion is that having some sort of coercion around configuration types is constructive, but as soon as it has the side effect of adding redundancy somewhere else in the code, it's gone too far. Right now, I think I'm gonna parse a second time the application.conf to get a json out of it, not that I like it but ApplicationConfiguration objects have close the door to every generic configuration handling.
    a
    r
    • 3
    • 5
  • r

    Robert Jaros

    06/02/2022, 5:00 PM
    I'm getting this error
    java.lang.NoSuchMethodError: io.ktor.client.request.HttpRequestKt.url$default(Lio/ktor/client/request/HttpRequestBuilder;Ljava/lang/String;Ljava/lang/String;ILjava/lang/String;Lkotlin/jvm/functions/Function1;ILjava/lang/Object;)V
    when using Ktor client 2.0.1. What could be the problem?
    s
    • 2
    • 1
  • s

    simon.vergauwen

    06/02/2022, 7:07 PM
    Hey everyone, Is this supposed to result in a graceful shutdown? Similar to if I would've called
    ApplicationEngine#stop
    ? Currently, I am seeing all open requests result in
    CancellationException
    .
    2022-06-02 20:52:27.779 [eventLoopGroupProxy-4-3] DEBUG ktor.application - 500 Internal Server Error: GET - /health. Exception class kotlinx.coroutines.JobCancellationException: LazyStandaloneCoroutine was cancelled
    Untitled.kt
    e
    • 2
    • 4
  • t

    Trey

    06/02/2022, 7:47 PM
    I'm trying to use CIO and I'm just getting around to running my iOS app. I'm seeing this illegal state exception and I'm wondering if there is a flag I'm missing that will allow me to use it? Should I not use it all until it gets out of the experimental phase?
    l
    m
    • 3
    • 9
  • n

    napperley

    06/02/2022, 10:47 PM
    How does the concurrency side of Ktor Server V2 (the Native version) work? Which C library does the Native version of Ktor Server use to provide the Web Engine (CIO)?
    h
    a
    • 3
    • 2
  • o

    Ovsyannikov Alexey

    06/03/2022, 10:47 AM
    Hello everybody 🙂 is tehre in ktor opportunity to automatically convert data types for
    setBody
    ? I am using list and it throw an error with
    Exception in thread "main" kotlin.reflect.jvm.internal.KotlinReflectionInternalError: Function 'create$lambda-0' (JVM signature: create$lambda-0(Lio/ktor/client/request/HttpRequestBuilder;Ldev/inmo/micro_utils/repos/ktor/client/crud/KtorWriteStandardCrudRepoClient;Ljava/util/List;)V) not resolved in class dev.inmo.micro_utils.repos.ktor.client.crud.KtorWriteStandardCrudRepoClient: no members found
    . I am using content negotiation and set up application json content type
    a
    p
    h
    • 4
    • 5
  • b

    Big Chungus

    06/03/2022, 8:46 PM
    Since ktor client needs to be closed, is it possible to somehow attach it to the CoroutineScope so that it would close when the scope cancels/completes?
    s
    • 2
    • 5
  • r

    rrva

    06/03/2022, 9:37 PM
    can I use ktor embedded server with h2c (http/2 over cleartext)
    • 1
    • 2
  • g

    Giuliopime

    06/03/2022, 9:47 PM
    My put and post routes that use resources don't get recognized by intellij 🤔
    a
    • 2
    • 3
  • s

    Satyam Agarwal

    06/04/2022, 9:26 AM
    Hei. Are there plans to simplifiy extending HttpClient plugins just like its been done for server plugins. New apis for server plugins are awesome. Would’ve been nice if it were done for the http client too.
    a
    • 2
    • 4
  • s

    Satyam Agarwal

    06/04/2022, 9:29 AM
    Another question that is bugging me. In
    ktor-server-call-logging
    https://github.com/ktorio/ktor/blob/main/ktor-server/ktor-server-plugins/ktor-server-call-logging/jvm/src/io/ktor/server/plugins/callloging/MDCProvider.kt#L12 Here mdc entries are registered in the plugin registry, but I couldn’t find out where they are extracted again back from the plugin registry to be used (they are however used from the pluginConfig, so I don’t see why these are being registered in pluginRegistry). Is this code redundant or is there any magic that I cant see 😅 ?
    a
    • 2
    • 7
  • s

    Satyam Agarwal

    06/04/2022, 12:09 PM
    Hei. Can someone elaborate on the difference between HttpSendPipeline and HttpRequestPipeline ?
    [HttpClient] Pipeline used for executing [HttpRequest].
    and
    [HttpClient] Pipeline used for sending [HttpRequest] to remote server.
    is still kind of vague for me.
    a
    • 2
    • 1
  • d

    doyaaaaaaken

    06/05/2022, 6:12 AM
    Hello, everyone. ✋ I implement database connecting process (
    Database.connect()
    ) on the beginning of Ktor’s booting process (the first line of
    Application.module()
    ). When I use Ktor v2, the
    testApplication
    method creates a Ktor server application on each test method. So, errors happens which says
    too many db clients
    . How do I solve it? Does anyone know this? 🙏
    h
    • 2
    • 2
  • b

    Big Chungus

    06/05/2022, 8:12 PM
    I'm making a TON of requests to the same host but different paths. Is it worth somehow keeping the client connection open between requests instead of closing and reopening them on each request? If so, how would that be done with ktor-client (looking at code
    get("url")
    closes the connection after the request is fulfilled).
    a
    • 2
    • 3
  • v

    Viktor Orlyk

    06/06/2022, 4:19 PM
    Hi, can someone help figuring out what is going wrong with this test https://stackoverflow.com/questions/72520472/ktor-testing-fail-to-serialize-body-content-has-type-class-but-outgoingcon Thanks in advance
    a
    • 2
    • 2
  • t

    Tucker Barbour

    06/06/2022, 8:01 PM
    I had a working implementation of a ktor server application using oauth where the oauth provider was selected based on the url path. I was able to accomplish this using the now deprecated Locations plugin. I’m reading through the source for the newer Resource plugin but I’m having trouble accomplishing the same thing.
    @Location("/") class index
    @Location("/auth/{type?}") class login(val type: String = "")
    @Location("/auth/{type}/callback") class callback(val type: String)
    
    val loginProviders = listOf(
      OAuthServerSettings.OAuth2ServerSettings(..),
      OAuthServerSettings.OAuth2ServerSettings(..)
    ).associateBy { it.name }
    
    fun Application.module() {
      install(Authentication) {
        oauth("oauth") {
          providerLookup = {
            loginProviders[application.locations.resolve<login>(login::class, this).type]
          }
          urlProvider = { p -> redirectUrl(callback(p.name), false) }
        }
      }
    }
    This is the gist with a bunch of other stuff left out. The key is begin able to map the url path to the name of the login provider. This ultimately allows a client to select which oauth provider to use. Any help or guidance would be appreciated.
    a
    • 2
    • 2
  • d

    David Stibbe

    06/06/2022, 9:19 PM
    Wanted to share this, perhaps I'm missing/misunderstanding something: I was running a Ktor 2.0
    testApplication
    test with 100 async calls by a client . However, it started locking up quite quickly and not even sending the remaining calls to the server. At first I thought this problem must be in my service. But in the end it even happened if the service did nothing. I solved it by configuring the CIO engine for the client
    val client = createClient {
                    engine { CIO }
                    install(WebSockets)
                }
    (the websockets is there because I needed it..) I was wondering: is this a known thing ? Or is there a different approach that would be preferred?
    a
    • 2
    • 2
  • p

    Peter Hsu

    06/06/2022, 10:37 PM
    seeing sporadic a crash when initializing ktor on an iOS client at launch
    #0	(null) in kfun:kotlinx.cinterop#<get-cstr>__at__kotlin.String(){}kotlinx.cinterop.CValues<kotlinx.cinterop.ByteVarOf<kotlin.Byte>> ()
    #1	(null) in kfun:kotlinx.cinterop#<get-cstr>__at__kotlin.String(){}kotlinx.cinterop.CValues<kotlinx.cinterop.ByteVarOf<kotlin.Byte>> ()
    #2	(null) in kfun:io.ktor.utils.io.charsets.CharsetImpl.<init>#internal ()
    #3	(null) in kfun:io.ktor.utils.io.charsets.Charsets#<init>(){} ()
    #4	(null) in InitSingletonStrict ()
    #5	(null) in 0x106780000 ()
    #6	(null) in Kotlin_initRuntimeIfNeeded ()
    #7	(null) in (anonymous namespace)::workerRoutine(void*) ()
    #8	(null) in _pthread_start ()
    #9	(null) in thread_start ()
    a
    • 2
    • 2
  • r

    ribesg

    06/07/2022, 8:22 AM
    If I want to define resources for routes starting with the same path, I need to put everything in the same class? https://ktor.io/docs/type-safe-routing.html
    a
    • 2
    • 3
  • m

    Mark Malik

    06/07/2022, 3:57 PM
    Hi Guys, I have a plugin written to expose a HealthCheck endpoint. It all works, and responds correctly, but I noticed I also get the following error:
    java.lang.UnsupportedOperationException: Headers can no longer be set because response was already completed
    	at io.ktor.server.netty.http1.NettyHttp1ApplicationResponse$headers$1.engineAppendHeader(NettyHttp1ApplicationResponse.kt:42)
    	at io.ktor.server.response.ResponseHeaders.append(ResponseHeaders.kt:57)
    	at io.ktor.server.response.ResponseHeaders.append$default(ResponseHeaders.kt:48)
    	at io.ktor.server.response.ApplicationResponsePropertiesKt.header(ApplicationResponseProperties.kt:14)
    	at io.ktor.server.plugins.cors.CORSKt.corsVary(CORS.kt:226)
    This is the plugin code:
    val HealthChecks: ApplicationPlugin<HealthConfig> = createApplicationPlugin("HealthChecks", ::HealthConfig) {
        on(CallSetup) { call ->
            if (call.request.path() != "/monitoring/health-check" && call.request.httpMethod != HttpMethod.Get) return@on
    
            var healthCheckStatus: Map<String, Boolean>
            runBlocking {
                healthCheckStatus = pluginConfig.performChecks()
            }
    
            val statusCode = when (healthCheckStatus.all { it.value }) {
                true -> HttpStatusCode.OK
                false -> HttpStatusCode.InternalServerError
            }
            call.respondText(Json.encodeToString(healthCheckStatus), ContentType.Application.Json, statusCode)
        }
    }
    I thought that I could use the plugin to expose request handlers not requiring to create a routing. Is there something invalid about this setup ? FYI. I have CORS enabled with anyHosts() option. The error is thrown in
    private fun ApplicationCall.corsVary() {
            val vary = response.headers[HttpHeaders.Vary]
            if (vary == null) {
                response.header(HttpHeaders.Vary, HttpHeaders.Origin)
            } else {
                response.header(HttpHeaders.Vary, vary + ", " + HttpHeaders.Origin)
            }
        }
    r
    • 2
    • 2
Powered by Linen
Title
m

Mark Malik

06/07/2022, 3:57 PM
Hi Guys, I have a plugin written to expose a HealthCheck endpoint. It all works, and responds correctly, but I noticed I also get the following error:
java.lang.UnsupportedOperationException: Headers can no longer be set because response was already completed
	at io.ktor.server.netty.http1.NettyHttp1ApplicationResponse$headers$1.engineAppendHeader(NettyHttp1ApplicationResponse.kt:42)
	at io.ktor.server.response.ResponseHeaders.append(ResponseHeaders.kt:57)
	at io.ktor.server.response.ResponseHeaders.append$default(ResponseHeaders.kt:48)
	at io.ktor.server.response.ApplicationResponsePropertiesKt.header(ApplicationResponseProperties.kt:14)
	at io.ktor.server.plugins.cors.CORSKt.corsVary(CORS.kt:226)
This is the plugin code:
val HealthChecks: ApplicationPlugin<HealthConfig> = createApplicationPlugin("HealthChecks", ::HealthConfig) {
    on(CallSetup) { call ->
        if (call.request.path() != "/monitoring/health-check" && call.request.httpMethod != HttpMethod.Get) return@on

        var healthCheckStatus: Map<String, Boolean>
        runBlocking {
            healthCheckStatus = pluginConfig.performChecks()
        }

        val statusCode = when (healthCheckStatus.all { it.value }) {
            true -> HttpStatusCode.OK
            false -> HttpStatusCode.InternalServerError
        }
        call.respondText(Json.encodeToString(healthCheckStatus), ContentType.Application.Json, statusCode)
    }
}
I thought that I could use the plugin to expose request handlers not requiring to create a routing. Is there something invalid about this setup ? FYI. I have CORS enabled with anyHosts() option. The error is thrown in
private fun ApplicationCall.corsVary() {
        val vary = response.headers[HttpHeaders.Vary]
        if (vary == null) {
            response.header(HttpHeaders.Vary, HttpHeaders.Origin)
        } else {
            response.header(HttpHeaders.Vary, vary + ", " + HttpHeaders.Origin)
        }
    }
r

Rustam Siniukov

06/07/2022, 4:00 PM
This is a bug on our side. Please create ticket.
m

Mark Malik

06/07/2022, 4:07 PM
https://youtrack.jetbrains.com/issue/KTOR-4433/UnsupportedOperationException-thrown-when-handling-requests-in-Custom-Plugins
View count: 18