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

    mp

    08/27/2018, 9:52 PM
    for instance, technically the hostname part of a URL vs the path can use different character encodings. Whyyyy...
    e
    • 2
    • 5
  • c

    coder82

    08/27/2018, 10:41 PM
    images already compressed should not be gzipped by default, what do you think ?
    d
    • 2
    • 1
  • v

    vincent.brule

    08/28/2018, 7:16 AM
    Hello, strange issue with the feature
    HttpsRedirect
    , when I go to my home page http://{...}/login I have an error because ktor redirect my to https like an infinite loop...
    ✅ 2
    📝 1
    d
    • 2
    • 37
  • a

    amt

    08/28/2018, 7:31 PM
    Has anyone experimented using ktor in a native image with Graal/SubstrateVM? Not much help from Google. Sorry if this is off-topic.
    б
    e
    • 3
    • 5
  • w

    wouterdoeland

    08/29/2018, 3:12 PM
    Hi, I have a problem. I'm getting constant exceptions in my application hosted with netty. The application I'm running is a plugin inside another software that also uses Netty. However, they use version 4.1.6.Final and Ktor uses a much newer version. This does not seem to work as Netty constantly throws exceptions that it can't find certain classes etc. Is there a fix for this? I already tried excluding Netty from the Ktor maven dependency, but that does not seem to work.
    d
    o
    • 3
    • 7
  • c

    cy

    08/29/2018, 6:16 PM
    📣 ktor
    0.9.4
    has been released * Added multiplatform client support (android and ios) * Added
    Android
    client engine (
    UrlConnection
    ) * Added
    OkHttp
    client engine (Android support) * Added
    Jackson
    feature support * Added
    Ios
    client engine * Deprecated
    response.contentType
    and
    response.contentLength
    * Strengthened
    IncomingContent
    deprecation * Upgraded Jetty ALPN, Tomcat * Fixed config evaluation issues (#488) * Disabled async incoming upgrade stream at Tomcat * Prohibited appending unsafe headers to request headers * Renamed
    XForwardedHeadersSupport
    to
    XForwardedHeaderSupport
    (#547) * Added
    HttpResponse.receive<T>
    method to run response pipeline on raw response * Introduced kotlin multiplatform url-parser * Supported client form data and multipart * Added missing client builders for
    post
    and
    put
    methods * Simplify client configuration API * Fixed several compression issues * Fixed client attributes evaluation * Fixed CIO engine random algorithm selection * Fixed url parsing (#511) * Fixed ambiguity in writing client
    Content-Type
    and
    Content-Length
    headers * Minor performance fixes * Netty HTTP/2 fixes * Fixed IOOBE in satic resource resolution (#493) * Fixed JWT error handling * Kotlin 1.2.61, kotlinx.coroutines 0.25.0
    🎉 16
    💥 7
    :kotlin-flag: 5
    :kotlin: 9
    r
    • 2
    • 1
  • m

    Mohit Gurumukhani

    08/29/2018, 11:55 PM
    Is there a way to specify content type while making http requests? I am getting UnsafeHeaderException: Header Content is controlled by the engine and cannot be set explicitly
    ✅ 1
    📝 1
    m
    e
    d
    • 4
    • 3
  • m

    mkporwit

    08/30/2018, 2:30 AM
    I’m trying to update to ktor-0.9.4, and gradle is unable to find kotlinx-coroutines-io 0.25.0, which is a dependency, it seems?
    b
    • 2
    • 8
  • u

    uli

    08/30/2018, 9:10 AM
    ByteReadChannel.copyTo(WritableByteChannel)
    is documented to only work with blocking NIO channels
    d
    c
    r
    • 4
    • 31
  • v

    vincent.brule

    08/30/2018, 10:14 AM
    Hello, I tried to update my gradle file to ktor 0.9.4 but I had this error, do you know how to solve this please ?
    -.kt
    ✅ 1
    e
    • 2
    • 3
  • v

    vincent.brule

    08/30/2018, 10:37 AM
    Another question with migration 0.9.3 to 0.9.4, the part with install JsonFeature is undefined now, do you know why please ?
    -.kt
    📝 1
    ✅ 2
    d
    e
    • 3
    • 12
  • v

    vincent.brule

    08/30/2018, 12:58 PM
    Hello again. I took this code from Ktor documentation and it no longer works with new migration to 0.9.4. Date and attributes are not good with the new migration. Do you know how to solve this please ?
    -.kt
    📝 1
    ✅ 2
    d
    • 2
    • 7
  • v

    vincent.brule

    08/30/2018, 1:21 PM
    Another strange issue with the migration, I obtain this error for one of my test. I don’t understand why I obtain invalid url format… for me it’s valid 😞
    -.kt
    ✅ 1
    e
    • 2
    • 6
  • m

    mp

    08/30/2018, 1:21 PM
    Since 0.9.4, I'm seeing this pop up in my logs:
    s.u.l.p.LocaleServiceProviderPool - A locale sensitive service provider returned null for a localized objects,  which should not happen.  provider: sun.util.cldr.CLDRCalendarDataProviderImpl@c9ab558 locale:
    . (Trailing empty string intentional.) When I breakpoint at that log, the stack trace indicates it's from the use of
    GMTDate()
    in the session cookie code. Any thoughts on how to mitigate it?
    c
    e
    • 3
    • 7
  • e

    enleur

    09/01/2018, 4:04 PM
    is there any way to call
    HttpResponse.readText
    twice on ktor client? I need to read response body in interceptor for logging
    d
    • 2
    • 3
  • e

    enleur

    09/01/2018, 4:57 PM
    @e5l I found another issue with ktor client. On
    sendPipeline
    when creating a new RequestBuilder https://github.com/ktorio/ktor/blob/master/ktor-client/ktor-client-core/src/io/ktor/client/HttpClient.kt#L65
    takeFrom
    method ignores attributes. So if I pass any attributes on call they got lost on this call
    👀 1
    e
    • 2
    • 3
  • j

    josephivie

    09/01/2018, 8:32 PM
    I've been trying to get it working, but it seems that implementing an interface that uses
    suspend
    breaks everything. Specifically I'm trying to use
    ContentConverter
    .
    e
    • 2
    • 2
  • o

    octylFractal

    09/03/2018, 7:11 AM
    Am I misunderstanding
    HttpClient#config
    ? I expected that it would be equivalent to adding the given block to the end of the original
    config
    block, but it instead it overwrites it
    d
    • 2
    • 11
  • б

    Бежан Александр

    09/03/2018, 3:11 PM
    Hey guys. I’m getting
    Failed to find a usable hardware address from the network interfaces
    on linux. But it works on Mac. It seems like netty issue, but it should be fixed in netty 4.1.24 that is used by ktor.
    d
    • 2
    • 23
  • c

    cmgurba

    09/04/2018, 9:35 PM
    I'm trying to narrow down an issue utilizing ktor HttpClient for many requests where I am getting a
    SocketTimeoutException
    on my last outgoing http request. Is the proper behavior to explicitly call
    close()
    on the client after all requests for a given "task" are completed, or to call
    close()
    after every request? also if anyone has found more doc/examples than this https://ktor.io/clients/http-client.html it would be appreciated 👍
    e
    • 2
    • 3
  • m

    Mohit Gurumukhani

    09/05/2018, 12:14 AM
    Hey! I am using ktor ios engine to make get requests. However, making get requests using client.get<String>(url) results in cinterop error as the native compiler treats get as cinterop function instead of the ktor function. Is there a way to force the compiler? I could use call in the meantime I guess.
    g
    • 2
    • 2
  • m

    Mohit Gurumukhani

    09/05/2018, 12:19 AM
    Also, even using call results in a ui freeze because multithreading is not supported. Oh well!
    g
    • 2
    • 2
  • a

    Albert

    09/05/2018, 1:24 PM
    Also when I reduce the
    connectionGroupSize
    to 1 the error disappears
    d
    • 2
    • 18
  • r

    rudolf.hladik

    09/05/2018, 2:37 PM
    is there some simple way to get all dependencies in one implementation? coz everything is just so spread and I dont know what dependencies to download. like where is JacksonSerializer?
    implementation "io.ktor:ktor-client-json:$ktor_version"
        implementation "io.ktor:ktor-jackson:$ktor_version"
        implementation "io.ktor:ktor-client-jackson:$ktor_version"
        implementation "io.ktor:ktor-client:ktor-client-jackson:$ktor_version"
    📝 1
    ✅ 1
    d
    e
    • 3
    • 47
  • r

    robin

    09/05/2018, 3:12 PM
    I can't find a way to do HEAD and OPTIONS requests via ktor-client - are these actually missing, or did I just look in the wrong place? I'd have expected them to look like
    httpClient.head(url)
    , just like
    httpClient.get(url)
    does
    ✅ 1
    📝 1
    d
    r
    e
    • 4
    • 11
  • z

    zpearce

    09/05/2018, 3:59 PM
    is there a way to use
    withTestApplication
    with
    HoconApplicationConfig
    instead of
    MapApplicationConfig
    ?
    б
    • 2
    • 1
  • c

    coder82

    09/05/2018, 5:38 PM
    is there a way to exclude a subdirectory inside a route when calling resources("web") and I want to exclude let's say web/js subdir?
    d
    • 2
    • 3
  • r

    rocketraman

    09/05/2018, 5:49 PM
    Using ktor 0.9.4 on Windows, upon Ktor startup I get a
    java.lang.VerifyError: Bad type on operand stack
    , but only when run from within IJ. When run outside of IJ via gradle, there is no issue. Also running the same app on my Linux box is fine. Anyone have any ideas?
    d
    b
    • 3
    • 10
  • z

    zpearce

    09/05/2018, 7:15 PM
    trying to get a test application engine working with HoconApplicationConfig. Here's what I'm trying:
    val env = applicationEngineEnvironment {
        config = HoconApplicationConfig(ConfigFactory.load())
    }
    withApplication(env) {
        // test code
    }
    This results in
    java.lang.UnsupportedOperationException: Packages and file facades are not yet supported in Kotlin reflection. Meanwhile please use Java reflection to inspect this class: class com.zpearce.AppKt
    What am I doing wrong? application.conf has the value "ktor.application.modules = [ com.zpearce.AppKt.main ]" in it, if that helps
    б
    • 2
    • 3
  • a

    Antero Duarte

    09/06/2018, 4:23 PM
    Hey there, is there a way to look at the changelog for 0.9.4 or is it still not out there? On a different matter, I updated to 0.9.4 because we are now able to customise the HTTPClient on instantiation with
    engine{ }
    . With the Apache engine, is there a way to append a header on every request that is made?
    ✔️ 1
    ✅ 1
    📝 1
    c
    d
    • 3
    • 5
Powered by Linen
Title
a

Antero Duarte

09/06/2018, 4:23 PM
Hey there, is there a way to look at the changelog for 0.9.4 or is it still not out there? On a different matter, I updated to 0.9.4 because we are now able to customise the HTTPClient on instantiation with
engine{ }
. With the Apache engine, is there a way to append a header on every request that is made?
✔️ 1
✅ 1
📝 1
c

cy

09/06/2018, 4:47 PM
See CHANGELOG.md https://github.com/ktorio/ktor/blob/a65667a6f0ca98128c38025f989bad7cb6da4576/CHANGELOG.md
To customize every client call you can try
DefaultRequest
feature and
defaultRequest { ... }
@Deactivated User we don't have a page about it on ktor.io yet
👌 1
d

Deactivated User

09/06/2018, 8:24 PM
Added: https://ktor.io/clients/http-client/features/default-request.html
:tnx: 1
a

Antero Duarte

09/07/2018, 10:09 AM
Brilliant, thank you! I guess I didn't find the changelog because there wasn't a release yet, only a tag. The Default request page is very helpful, thanks I've certainly learned a few things about ktor that I couldn't find in the docs. I will try to get some time to contribute them.
View count: 1