https://kotlinlang.org logo
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
  • e

    Elio Maroun

    12/06/2022, 12:42 PM
    https://stackoverflow.com/questions/74701831/kotlin-gmtdate-parsing
    a
    • 2
    • 19
  • e

    Elio Maroun

    12/06/2022, 12:43 PM
    hello anyone can help me please
  • a

    Abdulaziz Mohammed

    12/06/2022, 7:42 PM
    How can I hate end point with every change without make a lot of requests?
  • d

    Dani Morillas

    12/07/2022, 8:43 AM
    Good morning / good afternoon / good evening! I have a question regarding testing endpoints in ktor and the “new” testApplication. Last time I worked with ktor testApplication didn’t exist. I have this test
    @Test
    fun `when user user exists returns code 490`() : Unit = testApplication {
        val client = createClient {
            install(ContentNegotiation) {
                json()
            }
        }
    
        RepositoriesProvider.userRepository.add(User("", "username", "", false, 0, 0))
    
        val response = <http://client.post|client.post>("/signup") {
            contentType(ContentType.Application.Json)
            setBody(UserRequest("username", "password"))
        }
        assertThat(response.status).isEqualTo(HttpStatusCode.Conflict)
    }
    to test the end point. I define the testApplication and the client to install the ContentNegotiation. But I have two questions here: 1. Do I need to repeat the createClient code in every method? Is there any way I can wrap the testApplication with this initialization and use it in all the tests. 2. The instance of the userRepository object is different in this test than in the code when the endpoint is reached. Am I missing something in the initialization so I can use the same instance? Thanks in advance!
    a
    • 2
    • 5
  • m

    Martin Gaens

    12/07/2022, 10:44 AM
    Hey guys, I'm not sure if this is a Ktor issue, a gradle issue or a Kotlin multiplatform issue, however, it's a fullstack web app project generated by IntelliJ. The way to reproduce the issue is as follows: 1. Have IntelliJ Ultimate installed (newest version up until today) 2. Generate a Kotlin multiplatform project (Ktor backend, Kotlin/JS frontend) 3. Run the
    build
    Gradle task. 4. Watch the folder
    build/libs/
    . The
    .jar
    files get generated. Watch their size. 5. Go back to step 3. Doing this a couple of times causes the .jars to be exponentially large for some reason. I don't know why!
    a
    b
    • 3
    • 5
  • b

    Beowulf

    12/07/2022, 2:25 PM
    I am trying to create a custom deserialization for an enum. I recognise the enum based on an id. But in the JSON this value can be null, then I would like to take a default enum entry. But here the compile fails if I do the following:
    override fun deserialize(decoder: Decoder): MyEnum {
            return if (decoder.decodeNotNullMark()) {
                val enumValue = decoder.decodeInt()
                MyEnum.values().firstOrNull {
                    it.id == enumValue
                } ?: MyEnum.DEFAULT
            } else {
                MyEnum.DEFAULT
            }
        }
    org.jetbrains.kotlin.backend.common.BackendException: Backend Internal error: Exception during file facade code generation
    Anybody an idea how I can fix this?
    s
    • 2
    • 2
  • p

    Paul Woitaschek

    12/07/2022, 5:25 PM
    It would be great if the Ktor changelogs were a bit more “human readable”. https://github.com/ktorio/ktor/blob/main/CHANGELOG.md 2.2.0 indicates that it’s not just a patch release. It’s really hard to distinguish, which of the 67 bullet points are relevant and what’s the larger picture of this release is.
    a
    a
    +2
    • 5
    • 5
  • a

    Alexander Weickmann

    12/07/2022, 7:44 PM
    anyone else getting this error on startup after upgrading to ktor 2.2.0?
    java.lang.ClassNotFoundException: kotlinx.atomicfu.AtomicFU
    a
    j
    • 3
    • 4
  • n

    Nicolas Verinaud

    12/08/2022, 7:51 AM
    Hello ! Ktor-client 2.1.2 is not working on iOS 12. Is there an easy way to find the minimum iOS deployment target for each versions of Ktor-client ?
    e
    a
    i
    • 4
    • 6
  • b

    Bino

    12/08/2022, 9:01 AM
    Is there a way to secure the Swagger UI or OpenAPI with an auth?
    routing {
        authenticate("auth-basic") {
            this@routing.swaggerUI(path = "/swagger", swaggerFile = "openapi/documentation.yaml") {
                version = "4.15.5"
            }
        }
    }
    a
    • 2
    • 2
  • f

    FunkyMuse

    12/08/2022, 7:14 PM
    hey guys, why is open api generator available for embedded server type of app but not when configured by hocon, it’s not even available when the caret is over module function too, how do we generate open api for this use case?
    a
    b
    +2
    • 5
    • 10
  • h

    hiperbou

    12/09/2022, 12:43 PM
    Hello, how would a real world example using websocket and ProtoBuf look like? The examples in the documentation are mimicking what would be API endpoints (imo a really misleading example), while a real world application using websockets would look more like this, were each websocket message needs to be serialized to a different class to consume it. Here it's done by deserializing a Json once to get the message type and then again to get a full typed data class: https://github.com/vaibhavgoyal09/TicTacToeServer/blob/master/src/main/kotlin/com/vaibhav/routes/websockets/GameSocketRoute.kt#L75
  • a

    Adel Ayman

    12/09/2022, 4:50 PM
    What is best way to handle null fields in body?
    c
    • 2
    • 3
  • s

    Slackbot

    12/10/2022, 4:59 PM
    This message was deleted.
    f
    • 2
    • 1
  • r

    Rodrigo Silva

    12/10/2022, 6:11 PM
    Hello all. how do I create a createApplicationPlugin, which runs after the authentication phase?
    r
    • 2
    • 2
  • d

    Damien O'Hara

    12/11/2022, 1:46 PM
    hey all. has anyone dealt with latency issues running Ktor server on Google Cloud Run? seeing 5-6s server side latencies to serve 404s and server can only handle 1 request at a time. this is using something pretty close to the CIO server hello world example with gradle :installDist in the container and Ktor 2.0.1. no extra IO is performed on requests and I've ruled out startup time as an issue. latency remains 5-6s regardless of resource limits and the same config runs a NodeJS webserver with no issues. issue is not reproducible locally. anything I could be missing?
    f
    • 2
    • 2
  • a

    Alexandre Conte

    12/12/2022, 9:13 AM
    Hello all 🙂 I saw that in the last update you've added the Request limiter (max queries per XX unit of time), it is super cool, thanks! I was wondering if you will also consider a concurrent limiter. When average latency is required, it is easier to give the limit of a system by the maximum concurrency (based on the little's law of the queuing theory) It could be used very similarly to the request limiter
    a
    f
    • 3
    • 4
  • d

    dave08

    12/12/2022, 12:23 PM
    Is there any EASY way to get the body's object content from Ktor client's MockEngine's requestHistory?
    a
    k
    • 3
    • 11
  • d

    dave08

    12/12/2022, 12:23 PM
    I think that's one of the most basic needs in testing, and having OutgoingContent there isn't really useful at all...
  • a

    André Martins

    12/13/2022, 10:19 AM
    Hey is there any documentation on the mapping from old api pipelines for ktor client like this one for the server side https://ktor.io/docs/custom-plugins-base-api.html#mapping ?
    r
    • 2
    • 2
  • d

    dave08

    12/13/2022, 1:08 PM
    How do I send json in form data from the ktor client and receive it on a ktor server? I need multiple keys (json and json2) with json data in them in the same request.
    b
    a
    • 3
    • 11
  • a

    Andrey Tabakov

    12/13/2022, 1:35 PM
    How to configure websocket logs in ktor 2.2.1? Is there any docs?
    a
    • 2
    • 4
  • j

    Joshua Hansen

    12/13/2022, 4:59 PM
    Looking for some insight on this issue. In the IDE, my ktor client's requests go through just fine. After building with jpackage and installing on the same development machine, it appears that no request is ever being made by the client. A thread dump seems to show the thread just waiting forever. I'm unsure why this would be working in the IDE but now in the build, but I think it could be related to how ktor is working with the build tools we're using. Has anyone run into something like this before?
    • 1
    • 1
  • s

    Sean Proctor

    12/14/2022, 3:11 AM
    When sending a datagram using UDP, is it possible to determine the port it's sent from?
    a
    • 2
    • 6
  • j

    Jens Suhr

    12/14/2022, 10:49 AM
    Since the 2.2.0 update, the
    HostRouteSelector::evaluate
    function uses
    context.call.request.origin.serverPort
    to determine if a request matches the
    port
    routing filter. I’m not sure why it doesn’t call
    localPort
    instead, as that’s (as far as I understand) the port where the request is actually received. We use a ktor application with CIO in k8s behind mapped ports and an ingress, so the port in the
    Host
    headers is something completely different from what we specify in our routing. Before 2.2, it worked - probably by accident - because CIO used the local information first. Is there a way to make this work with 2.2? Doesn’t seem like an unusual use case, but I’m probably missing something simple here.
    a
    • 2
    • 6
  • b

    Berkay Özkan

    12/15/2022, 9:26 AM
    https://ktor.io/docs/swagger-ui.html Is there a way to do add headers to openapi automatically?
    a
    • 2
    • 4
  • l

    leandro

    12/15/2022, 3:43 PM
    Is
    HttpClientEngineBase
    intended to be subclassed? I ask because
    suspend fun execute(data: HttpRequestData): HttpResponseData
    is maked as
    @InternalAPI
    , but
    HttpClientEngineBase
    itself isn’t.
    a
    • 2
    • 2
  • a

    Aminu Babayo Shehu

    12/16/2022, 2:33 PM
    For newbies to Ktor check out this repo for a simple user authentication using Ktor, FreeMarker and Postgres database. https://github.com/absheikh/User-Authentication-With-Ktor-Freemarker-and-Postgres
  • r

    ribesg

    12/16/2022, 3:53 PM
    The clickable "17" link in the latest blog post points to an empty list for me. @hhariri
    h
    p
    • 3
    • 2
  • a

    Adam Cooper

    12/16/2022, 8:48 PM
    Does the part of the Ktor roadmap regarding authz/n plugins include better support for multiplatform? last time i checked the JWT plugin didn't work on native
Powered by Linen
Title
a

Adam Cooper

12/16/2022, 8:48 PM
Does the part of the Ktor roadmap regarding authz/n plugins include better support for multiplatform? last time i checked the JWT plugin didn't work on native
View count: 10