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
  • j

    jkbbwr

    01/24/2019, 12:34 AM
    Anyone know when a new release will be coming?
    e
    j
    • 3
    • 3
  • c

    ctierney

    01/24/2019, 3:36 PM
    Question about the kotlinconf-app sample: The
    Database
    class is full of suspending functions (e.g. https://github.com/JetBrains/kotlinconf-app/blob/master/backend/src/org/jetbrains/kotlinconf/backend/database.kt#L42) that use a dedicated fixed threadpool context. I was wondering what the benefit of this style is? I would understand if the rest of the app called these functions using
    async
    or something, but as they are all just called synchronously I’m wondering if writing them as suspending functions does anything particular. (Also, as they are not called asynchronously---how does that fixed thread pool actually get used?)
    b
    • 2
    • 5
  • f

    functionaldude

    01/24/2019, 8:03 PM
    Hi! I read this tutorial https://ktor.io/advanced/utilities.html. This states that
    parseUrlEncodedParameters(...)
    is used to parse the form-url encoded data from the request body, but then I looked at the function source, the comment said
    Parse URL query parameters. Shouldn't be used for urlencoded forms because of "+" character.
    I assume this function is only ment to be used on the actual URL parameter, but not on the body. I also found a function
    parseQueryString(...)
    which produces the correct result on the body. Is this just an oversight in the docs, or am I missing something?
    v
    • 2
    • 1
  • c

    cy

    01/24/2019, 10:06 PM
    📣 New ktor 1.1.2 released! * Introduced native curl client engine (#479) * Added iosArm32 target (except curl) * Host and port route builders (#825) * Fixed
    host()
    and
    port()
    functions to respect proxy (#834) * Fixed classloading issue affecting hot-reload (#825) * Fixed hanging CIO client (#800, #806) * Added CIO client CBC support (#623, #560, #394) * Upgraded JWKS/JWT (#856) * Fixed server
    MessageDigest
    concurrent issues * Introduced
    NonceManager
    , deprecated
    OAuth2StateProvider
    * Prohibited setting session at server after responding the call (#864) * Fixed loosing errors in
    StatusPages
    if there was already a response sent * Introduced
    application
    property on
    ApplicationEngine
    interface * Introduced experimental ktor server exceptions *
    BadRequestException
    *
    NotFoundException
    *
    MissingRequestParameterException
    *
    ParameterConversionException
    * supported in locations out of the box (including #767) * experimental parameters delegation support * Added routing tailcard prefix support (#876, #526) * Fixed registering content converters with custom content type pattern (#872) * Improved GSON error diagnostics (#811) * Exclude several content types in Compression feature by default: audio, video, event-stream (#817) * Fixed hanging handleWebSocketConversation * Fixed cookie session max-age value to be bumped to Int.MAX_VALUE (#892) * Fixed CIO headers parsing: allowed headers with no values * Fixed client websocket nonce size (#861) * Fixed client scheme parsing * Supported client relative redirects by making #takeFrom() resolve relative urls. (#849) * Fixed network on main thread in CIO (#764) * Changed the default algorithm to SHA-256 from SHA-1 for signed server cookies * Fixed conflicting
    WebSockets
    and
    StatusPages
    (#889) * Update gradle to 4.10 * Kotlin 1.3.20, kotlinx.coroutines 1.1.1, kotlinx.serialization 0.10.0 Please note that you have to migrate to Gradle 4.10+ to use ktor with MPP (multiplatform projects) due to Gradle metadata version change. https://ktor.io/quickstart/migration/1.1.2.html
    🎉 26
    🐸 1
    v
    m
    m
    • 4
    • 8
  • t

    Talon

    01/24/2019, 10:43 PM
    I'm trying to run a ktor API on my raspberrypi but I get this error
    io.ktor.client.call.ReceivePipelineException: Fail to run receive pipeline
    doesn't happen locally, I'm thinking maybe I need to configure the client differently or something timeout related?
    c
    • 2
    • 2
  • c

    coletz

    01/25/2019, 9:34 PM
    is it normal that intellij can't find the package io? using kotlin 1.3.20, intellij 2018.1.3, ktor 1.1.2, gradle 4.10.1 (it compiles, but intellij is showing errors everywhere... this is NOT wrong dsl highlight color as pointed out here https://youtrack.jetbrains.com/issue/IDEA-204487, I am getting error eg on object returned by ktor get, intellij can't detect type etc)
    e
    n
    • 3
    • 8
  • c

    codyoss

    01/26/2019, 2:59 AM
    Is there a reason ktor clients don't return one of the companion objects for
    HttpStatusCode
    ? It seems like the code just constructs a new one one that matches the status
    Int
    . I found this odd when I did a
    when
    switch on the status from
    HttpResponse
    and the status did not match
    HttpStatusCode.OK
    .
    e
    • 2
    • 3
  • s

    Saiedmomen

    01/26/2019, 10:08 AM
    How can I simulate a no network situation with
    MockEngine
    ?
    a
    g
    • 3
    • 5
  • g

    galex

    01/27/2019, 5:09 AM
    Can I use ktor-client-common for a js node app? The documentation talk about clients only for android and iOS, but I can see there’s a kotlin-client-js in the github repo which is just a dependency to ktor-client-common?
    📝 1
    a
    • 2
    • 3
  • w

    wollnyst

    01/27/2019, 2:29 PM
    How can I set an instance of
    kotlinx.serialization.json.JsonObject
    as body on a ktor-client? The following calls fails with
    kotlinx.serialization.SerializationException: Can't locate argument-less serializer for class kotlinx.serialization.json.JsonObject
    kotlin
      val client = HttpClient(OkHttp) {
          install(JsonFeature) {
              serializer = KotlinxSerializer(JSON.nonstrict)
          }
      }
      <http://client.post|client.post><Unit>(url) {
          body = json { "hello" to "world" }
    
      }
    e
    s
    • 3
    • 3
  • j

    jdiaz

    01/27/2019, 6:44 PM
    I'm trying to build ktor from scratch (I'm interested in native curl, I need to customize the libcurl client) but tests are failing, is this known?
    [ RUN      ] io.ktor.client.test.CurlEnginesTest.postTest
    kotlin.AssertionError: Expected <HttpBinResponse(url=<http://httpbin.org/post>, args={}, headers={Content-Type=text/plain; charset=UTF-8, Accept=application/json, Content-Length=11, Connection=close, Host=<http://httpbin.org|httpbin.org>})>, actual <HttpBinResponse(url=<http://httpbin.org/post>, args={}, headers={Accept=application/json, Connection=close, Content-Length=11, Content-Type=text/plain; charset=UTF-8, Host=<http://httpbin.org|httpbin.org>, X-Imforwards=20})>.
    e
    • 2
    • 11
  • v

    Vinicius Carvalho

    01/27/2019, 8:59 PM
    suspend fun request(offset: Int, limit: Int, endpoint: String) : ApiResponse<List<Map<String,Any>>> {
            val end = limit + offset
            
            return retroClient.request(endpoint = endpoint, offset = offset, limit = limit).execute().body()!! //using retrofit, works
    
    //        internalClient.request {
    //            url(URL("$BASE_URL$endpoint?offset=$offset&limit=$limit&format=json&api_key=$API_KEY"))
    //            method = HttpMethod.Get
    //            headers {
    //                append("User-Agent" , "Ktor Apache Client")
    //                append("Content-Type", "application/json")
    //            }
    //        }
        }
    u
    e
    • 3
    • 9
  • d

    dave08

    01/28/2019, 1:16 PM
    ctrl-click even leads me to the right declaration (I think..).
    e
    a
    g
    • 4
    • 5
  • d

    dave08

    01/28/2019, 1:43 PM
    Or do I really have to use the
    JsonFeature
    for this?
    e
    • 2
    • 4
  • d

    dave08

    01/28/2019, 5:15 PM
    It would be great to have something like delegate properties for
    ApplicationConfig
    ... it's really a bit verbose right now. Instead of:
    val username = config.property("username").getString()
    , it could be
    val username: String by config
    !!!
    b
    • 2
    • 21
  • c

    codyoss

    01/28/2019, 9:34 PM
    Does ktor natively support something Spring’s
    @ConfigurationProperties
    . I am looking for an easy way to bind a subset on my configuration file to an object. Anything besides me writing custom getters that have a reference to the
    Application.enviorment.config
    ?
    d
    • 2
    • 2
  • n

    napperley

    01/29/2019, 12:38 AM
    Is it possible to use Log4j Kotlin ( https://logging.apache.org/log4j/kotlin/index.html ) with Ktor?
    r
    • 2
    • 16
  • s

    Santosh Astagi

    01/29/2019, 1:50 AM
    I am trying a post request with no response but get a Can't locate argument less serializer error
    s
    • 2
    • 2
  • a

    Aharon

    01/29/2019, 7:20 AM
    Is it ok to keep a long living instance of io.ktor.client.HttpClient and just call close() on all the HttpResponse objs ? I'm asking cause the docs only talk about closing the HttpClient itself (https://ktor.io/clients/http-client/calls/requests.html) Also we've got a memory leak somewhere in there now...
    :yes: 1
    e
    • 2
    • 3
  • g

    Graeme

    01/29/2019, 8:10 AM
    @codyoss we have support for
    @ConfigurationProperties
    which you can use in
    micronaut-ktor
    https://github.com/micronaut-projects/micronaut-kotlin
    💯 1
    c
    • 2
    • 1
  • r

    ribesg

    01/29/2019, 8:59 AM
    Is
    ktor-client-cio
    pure Kotlin or not? Can I use it in the common part of a MPP?
    e
    • 2
    • 5
  • a

    Alan Pierri

    01/30/2019, 2:09 PM
    I'm using ktor also as a client to connect to a https API with self-signed certificate, and I was wandering if there was any way to validate the requests knowing the other end has self-signed cert (skipping CA)
    e
    • 2
    • 9
  • s

    Santosh Astagi

    01/30/2019, 7:32 PM
    I get a list back from API call, so I have a kotlinxSerializer where I am registering two lists, as val kotlinxSerializer = KotlinxSerializer() kotlinxSerializer.register(FirstList.serializer().list) kotlinxSerializer.register(SecondList.serializer().list) However, when I make the call, only the last registered serializer is used. How can I register multiple lists to the serializer?
    e
    • 2
    • 9
  • a

    Albert

    01/30/2019, 8:14 PM
    Is it possible to start ktor server on a random port? I am using this:
    embeddedServer(Netty, port = 0)
    But I don't know where I can get the random port from. And the logs are showing it is listening on
    <http://0.0.0.0:0>
    y
    • 2
    • 2
  • l

    Louis Saglio

    01/30/2019, 10:11 PM
    message has been deleted
    c
    • 2
    • 3
  • r

    rrva

    01/31/2019, 5:58 AM
    Looking at
    NettyApplicationEngine
    , why does ktor run application code in a threadpool of its own?
    c
    • 2
    • 2
  • k

    Kenneth

    01/31/2019, 3:03 PM
    Does ktor use anything not supported by GraalVM?
    c
    a
    • 3
    • 3
  • b

    Brian Mahecha

    01/31/2019, 4:12 PM
    Morning everyone, looking to take an existing Spring Boot application and create the same one using KTor. How has everyones experience with KTor been coming from a Spring background?
    c
    v
    a
    • 4
    • 9
  • j

    jozefdransfield

    01/31/2019, 4:27 PM
    Hello, does anyone know if Ktor has support for client certifications with ssl?
    c
    e
    • 3
    • 2
  • m

    mp

    01/31/2019, 10:08 PM
    Anyone tried putting together a ktor / new relic integration?
    c
    • 2
    • 2
Powered by Linen
Title
m

mp

01/31/2019, 10:08 PM
Anyone tried putting together a ktor / new relic integration?
c

codyoss

01/31/2019, 10:13 PM
No, but if you add the metrics module you should be able to at least scrap the JMX info pretty easy I would assume…
m

mp

02/01/2019, 3:41 AM
Yeah, I’m more interested in tracking http requests
View count: 16