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

    hyukchan

    04/11/2019, 9:52 AM
    Hi, I'm having an issue understanding and using suspend function with dependency injection ...
    class SdWsService(fileUtils: FileUtils) {
        suspend fun getXmlFile(environment: String?, filename: String): String = dbQuery(environment) {
    Inside getXmlFile, I do not have access to my fileUtils ...
    d
    • 2
    • 2
  • p

    Patrick Jackson

    04/11/2019, 3:23 PM
    Any advice on implementing Cacheing with Ktor http client? struggling with CacheControl. Working with the MPP client
    e
    • 2
    • 2
  • r

    ribesg

    04/12/2019, 8:05 AM
    Is there a visual description of how the ktor client pipelines connect each other, to better know which pipeline I should intercept?
    d
    • 2
    • 12
  • l

    lovis

    04/12/2019, 9:25 AM
    I can’t seem to use client/JsonFeature. I declared the dependency (
    "io.ktor:ktor-client-json:$ktor_version"
    ) in my build.gradle, and I see it (can even navigate into it) in IntelliJ. But I can’t call install(JsonFeature)` . (“Unresolved Reference”) I tried the fully qualified name,
    gradle clean
    , and even deleting the whole
    ~/.gradle
    folder. Nothing. Hitting “build” tells me, that client-json requires “’org.jetbrains.kotlinx:kotlinx-serialization-common:0.10.0”, but adding that to dependencies also doesn’t help. And also, it shouldn’t be that hard. Any ideas?
    e
    • 2
    • 6
  • t

    tjohnn

    04/12/2019, 10:09 AM
    How can I achieve something like this with ktor routing?
    fun Routing.v1() {
        route("/api/v1") {
            posts()
        }
    }
    I am getting
    fun Routing.posts() can't be called in this context by implicit receiver
    m
    • 2
    • 2
  • r

    robin

    04/12/2019, 11:12 AM
    I'm having a little encoding problem here, can someone point in the right direction? I have a simple route set up that simply sends the contents of the POST body back to the client:
    post("/reflect") {
        call.respondText(call.receiveText().also(::println))
    }
    When I send a request with special characters in it like this:
    POST <http://localhost:8080/reflect>
    Content-Type: text/plain
    
    ÄÖÜäöüßẞ
    It comes out as a jumbled mess:
    ÃÃÃäöüÃáº
    And it get's printed to the console exactly like that as well, so the problem has to be on the receiving side, not the sending side. I'm not sure where to start looking what is going wrong here.
    j
    d
    • 3
    • 6
  • r

    ribesg

    04/12/2019, 1:00 PM
    How would I retry a request with new headers in a feature in the ktor client?
    e
    • 2
    • 6
  • l

    lovis

    04/12/2019, 1:31 PM
    in the ktor client, we can specify
    expectSuccess = false
    to control whetehr an exception should be thrown if the status is >= 300. can I also have more fine-grained control out-of-the-box? E.g. allowing 404 but throwing otherwise
    r
    e
    • 3
    • 3
  • l

    Lawik

    04/12/2019, 1:37 PM
    How can I register multiple serializers when using a class with generic type, for example:
    Response<Foo>
    Response<Bar>
    r
    • 2
    • 23
  • j

    JoakimForslund

    04/12/2019, 2:03 PM
    Is there an existing way of running certificate pinning on iOS and android targets with ktor httpClient?
    e
    • 2
    • 2
  • r

    ribesg

    04/12/2019, 2:36 PM
    I should not be forced to call
    .build()
    on a
    HttpRequestBuilder
    to get the
    attributes
    already set on that builder
    e
    • 2
    • 12
  • s

    spierce7

    04/12/2019, 7:28 PM
    What version of Ktor should I be using with Kotlin 1.3.30?
    t
    e
    s
    • 4
    • 7
  • i

    ivanmorgillo

    04/14/2019, 3:16 PM
    I have been building a small http server with ktor on heroku and I have reached a point where I want to have some metrics. I'm mainely building android apps so in my world there are things like crashlytics and amplitude. can you point me to a possible solution for monitoring errors, i.e. 40*, 50*, or other non fatal issues? 😄
    m
    r
    • 3
    • 3
  • f

    Felix

    04/14/2019, 3:59 PM
    Hi. Where can I read more about the rationale to divide the
    ApplicationCallPipeline
    into the 5 phases:
    Setup
    ,
    Monitoring
    ,
    Features
    ,
    Call
    , and
    Fallback
    ? Namely, what are the responsibilities of the interceptors in each phase?
    b
    • 2
    • 4
  • f

    Felix

    04/14/2019, 9:18 PM
    Since apparently routes have their own pipeline (https://ktor.io/advanced/pipeline/route.html), is it possible to install a feature on a route's pipeline? I tried doing something like
    route("/foo", HttpMethod.Get) {
                install(ExampleFeature)
                handle {...}
    }
    However the feature appears to run for all routes.
    b
    o
    • 3
    • 6
  • r

    ribesg

    04/15/2019, 11:57 AM
    So... what’s the current status of Ktor 1.2 with Kotlin 1.3.30 and Coroutines 1.2 and Serialization 0.11?
    😴 1
    • 1
    • 1
  • l

    Lawik

    04/15/2019, 1:01 PM
    Is this the best way to handle deserialization of lists with the http client on the JS platform? https://stackoverflow.com/a/54714777 I see a setListMapper function but that doesn't seem to do anything.
    r
    r
    j
    • 4
    • 23
  • e

    e5l

    04/15/2019, 4:43 PM
    📣 New ktor
    1.1.4
    released! It’s the minor release with kotlin
    1.3.30
    support.
    🚀 6
    🎉 14
    ❤️ 2
    s
    s
    c
    • 4
    • 4
  • r

    rodrigo

    04/16/2019, 12:33 PM
    I’m trying to execute the following post request but I get an exception from the coroutine with
    Parent job is Completed
    ? Just wondering what I may be doing wrong 😕, the request seems fine from the logger
    -.kt
    e
    • 2
    • 2
  • n

    Nikolai

    04/16/2019, 12:46 PM
    Hi, I am using .ktor and okhttp engine. And got exception certpathvalidatorexception when we tried to migrate to https, can I use ktor fot https? And if ‘yes’ where start searching to solve my issue, I think it’s because we use some like backend developers says ‘custom certificate’.
    e
    b
    • 3
    • 10
  • m

    max.cruz

    04/16/2019, 2:59 PM
    Hi. I have the following warning when building a Gradle module in an MP project
    warning: this class can only be used with the compiler argument '-Xuse-experimental=kotlin.Experimental'
    @UseExperimental(KtorExperimentalAPI::class)
    I’m trying to use IosHttpRequestException, but adding the mentioned option in
    kotlinOptions.freeCompilerArgs
    seems not to work. Any suggestion to fix the warning? Thanks.
    e
    • 2
    • 2
  • n

    napperley

    04/16/2019, 11:21 PM
    With the Http client are there alternative ways to handle WebSocket events that don't involve streaming?
    e
    • 2
    • 3
  • s

    Slackbot

    04/17/2019, 6:14 AM
    This message was deleted.
    g
    g
    • 3
    • 3
  • j

    Justin Tuchek

    04/17/2019, 3:29 PM
    Is anyone else using IntelliJ 2019.1 and the Ktor plugin? Experiencing an issue where new projects cannot be created while the plugin is active.
    e
    • 2
    • 3
  • n

    napperley

    04/18/2019, 1:10 AM
    Has anyone experienced a "connection reset by peer" message when using SSL with Ktor Server (using Netty as the web engine) when its under a bit of load?
    • 1
    • 2
  • s

    Sander Ploegsma

    04/18/2019, 8:11 AM
    Does anyone know how to add OpenGraph meta tags using the HTML DSL? I need to be able to add tags such as
    <meta prefix="og <http://ogp.me/ns#>" property="og:title" content="title" />
    But the
    META
    class doesn't seem to support the
    prefix
    and
    property
    attributes. Currently I'm using
    unsafe
    to render the raw HTML, but I'd prefer not to.
    r
    • 2
    • 3
  • h

    hdarritchon

    04/18/2019, 1:16 PM
    Hi, as I had no answer, I try an other time to ask my question. Thanks for your comprehension and your help. “hi, in my API app, I’d like to decorate (sort of programming by aspect) all my request by a method to compute how long it takes to process it. I need to do some measure. Right now, I am looking at Route interception to do the job but I am quite lost on how it is working (I read the article https://ktor.io/advanced/pipeline/route.html) but sorry, I didn’t manage to make it work. Do you have any clue, hint ou may be a link on a sample ? Is it a good practice to use Route Interception to do this kind of job ?”
    d
    • 2
    • 5
  • h

    hmole

    04/19/2019, 7:02 AM
    How can I install a feature(or `Application.intercept') only a subset of routes? For example every request to
    com/foo
    and
    com/foo/***/***
    should trigger the feature.
    r
    • 2
    • 1
  • n

    Nikky

    04/20/2019, 3:50 PM
    so before i try to use ktor-httpclient for something thats impossible.. when i try to use it on javascript i can not run it in the background because of the lack of threading correct ? so i i want to do things i have to make do with simple GET and POST requests instead of keeping open some connection and processing data in aprallel or can i do that in kotlin-js ?
    b
    • 2
    • 2
  • q

    qlitzler

    04/21/2019, 5:14 PM
    Hello I have the weirdest behaviour with 1.1.4 When passing
    logLevel = LogLevel.NONE
    any call to
    httpClient.request<T>
    will hang indefinitely. If i put any other logLevel (
    LogLevel.ALL
    for example), it works fine..
    1.2.0-alpha-1.3.0-eap-125
    works fine as well I saw this in the 1.2.0 changelog:
    Fixed LogLevel.NONE with body bytes
    , is this related ?
    e
    • 2
    • 2
Powered by Linen
Title
q

qlitzler

04/21/2019, 5:14 PM
Hello I have the weirdest behaviour with 1.1.4 When passing
logLevel = LogLevel.NONE
any call to
httpClient.request<T>
will hang indefinitely. If i put any other logLevel (
LogLevel.ALL
for example), it works fine..
1.2.0-alpha-1.3.0-eap-125
works fine as well I saw this in the 1.2.0 changelog:
Fixed LogLevel.NONE with body bytes
, is this related ?
e

e5l

04/22/2019, 3:50 PM
Hi @qlitzler, yep. The fix will be available with 1.2.0
q

qlitzler

04/22/2019, 3:50 PM
Alright, thank you !
View count: 1