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

    rocketraman

    07/10/2018, 4:19 PM
    Hmm, I seem to be having a basic problem with ktor cio client... If I execute a call once, it works, but the second time the coroutine never continues.
    📝 1
    o
    d
    e
    • 4
    • 37
  • p

    pnih

    07/11/2018, 1:37 PM
    For:
    @Location("/api/customer_book_list/{customerId}")
    data class CustomerBookList(val customerId: String, val type: Int, val update_at: Long)
    This curl doesn't resolve:
    curl -v <http://localhost:8380/api/customer_book_list/{customerId}?type=0&update_at=987654345>
    But if I have one parameter:
    @Location("/api/customer_purchase_li{customerId}")
    data class CustomerPurchaseLi(val customerId: String, val update_at: Long)
    a request :
    <http://localhost:8380/api/customer_purchase_li{customerId}?update_at=09876543>
    does resolve, is there any problem with more than one query parameter being passed to a Location?
    d
    • 2
    • 47
  • m

    martmists

    07/11/2018, 7:25 PM
    Anyways I'm the author of the issue here: https://github.com/ktorio/ktor/issues/475
    d
    • 2
    • 16
  • m

    martmists

    07/11/2018, 8:29 PM
    Also, how on earth do I enable any form of dark theme, this is hurting my eyes jfc
    m
    d
    • 3
    • 2
  • d

    danielm

    07/12/2018, 7:33 AM
    Is there a way to use jackson for the client JsonFeature? The GsonSerializer does not seem to respect @JsonIgnore annotations
    e
    o
    • 3
    • 4
  • d

    dave08

    07/15/2018, 2:58 PM
    Tried making a Location w/ a Data Converter for customer... I would have expected it to work? Otherwise I'd have a Location with
    data class UserRequest(val `customer[id]`: Int ...)
    ... 🙈
    d
    • 2
    • 46
  • g

    GreyhairRedbear

    07/16/2018, 7:40 PM
    Hi all! Does by chance anybody know if it's possible to use ktor as a HTTP client in an android application? After reading the documentation I suppose the CIO-client could work, can anyone confirm that?
    e
    e
    • 3
    • 4
  • v

    vincent.brule

    07/17/2018, 9:41 AM
    Hello ! Just a question not a problem 🙂 I use session feature with header. When I inspect my request, I have my header who is send but for each request ktor send another header different than mine, why please ?
    ✅ 1
    d
    • 2
    • 55
  • n

    Nikky

    07/17/2018, 10:44 AM
    so i have a weird issue.. i am using ktor with tomcat and am running it with ./gradlew tomcatRun and i also have a nginx reverse proxy set up for ssl a single endpoint where i am building html and link to a stylesheet gives a empty response
    d
    • 2
    • 37
  • t

    tianhao

    07/17/2018, 12:29 PM
    Does anyone have a sample code for Kodein with Ktor? Thanks
    d
    d
    • 3
    • 3
  • d

    dave08

    07/17/2018, 1:33 PM
    How do I make a JsonSerializer for the Ktor client JsonFeature for Klaxon? I have this:
    class KlaxonSerializer(block: Klaxon.() -> Unit = {}) : JsonSerializer {
    
    	private val backend: Klaxon = Klaxon().apply(block)
    
    	override fun write(data: Any): OutgoingContent = TextContent(backend.toJsonString(data), ContentType.Application.Json)
    
    	override suspend fun read(info: TypeInfo, response: HttpResponse): Any {
    		val text= response.readText()
    		return backend.parse(text) as info.type
    	}
    }
    but obviously info.type won't work there and the parse function takes a reified type...
    d
    • 2
    • 22
  • v

    Vinicius Carvalho

    07/17/2018, 8:38 PM
    Hi all, I'm following the steps outlined here: https://ktor.io/servers/engine.html#running-the-application-from-inside-the-ide, but when I create my run configuration it still throws an error:
    Error: Could not find or load main class io.ktor.server.netty.DevelopmentEngine
    d
    m
    • 3
    • 4
  • m

    mp

    07/17/2018, 10:04 PM
    I'm having an odd issue with writing tests for multipart upload endpoints. (It seems to work ok outside of tests.) When I upload data in a file part, the byte contents seem to get mangled. https://bitbucket.org/marshallpierce/ktor-multipart-upload-test-repro/src/master/src/test/kotlin/org/mpierce/ktor/multipart/MultipartTest.kt (small, runnable project) exhibits the issue for me.
    d
    • 2
    • 13
  • v

    Vinicius Carvalho

    07/18/2018, 1:06 AM
    and the zip file for some reason creates a directory with 555 permission instead of 755
    d
    • 2
    • 2
  • k

    kurus

    07/18/2018, 3:08 AM
    How to pronounce Ktor? https://www.howtopronounce.com/ktor/
    d
    • 2
    • 1
  • d

    Deactivated User

    07/18/2018, 4:55 AM
    I have added an incomplete and experimental support for Swagger to the Ktor project generator: https://ktor.io/quickstart/generator.html (will be in the next version of the plugin too). If you have the chance, early feedback would be really appreciated 🙂
    👍 3
    v
    • 2
    • 4
  • j

    Jordan Terrell

    07/20/2018, 1:46 PM
    Found a memory leak issue when using ktor. It's causing our app to get OOMKilled: https://github.com/ktorio/ktor/issues/489
    👌 1
    d
    • 2
    • 1
  • v

    Vinicius Carvalho

    07/20/2018, 4:08 PM
    Hi all, is there any samples of integrating ktor and kodein?
    d
    o
    • 3
    • 7
  • f

    fred.deschenes

    07/20/2018, 5:55 PM
    I found 2 issues regarding static content resolution, both of them are reproduced in the same way but have different causes depending on how the server is ran (ie: from an IDE vs from a JAR), should I put in 2 issues/PRs or can I combine this into 1?
    • 1
    • 2
  • i

    Ivan Podhornyi

    07/23/2018, 11:16 AM
    got an error
    kotlin.UninitializedPropertyAccessException: lateinit property sqls has not been initialized
    g
    • 2
    • 5
  • v

    vincent.brule

    07/24/2018, 8:35 AM
    Hello, is there a documentation on ktor or a sample to proxy in image, receive this image and send it to the client directly please ?
    ✅ 1
    d
    o
    e
    • 4
    • 14
  • v

    vincent.brule

    07/24/2018, 1:06 PM
    I have a strange issue. I use session client-side. With this code, I check if the ttl is ok and after I send the session. But if I do multiple request in the same time, the duration value become negative sometimes with the same header in input. If I comment the code for the ttl check, that works perfectly. Do you know why please ?
    Issue_session_feature.kt
    c
    e
    • 3
    • 10
  • j

    Jordan Terrell

    07/24/2018, 6:38 PM
    Any idea when 0.9.4 will be released?
    c
    • 2
    • 1
  • j

    joshr

    07/26/2018, 9:23 PM
    https://github.com/ktorio/ktorio.github.io/blob/master/advanced/features.md
    ✅ 1
    📝 1
    c
    • 2
    • 1
  • r

    rocketraman

    07/27/2018, 12:34 AM
    I seem to have an issue with ktor 0.9.3 related to consuming bytes from
    call.request.receiveChannel()
    -- after ktor has been idle for a while, I am unable to consume the full length of the data.
    e
    • 2
    • 4
  • m

    martmists

    07/28/2018, 8:19 PM
    Is there a way to do
    get("/api/<something: int>/<other: string>")
    in ktor?
    d
    • 2
    • 20
  • m

    martmists

    07/29/2018, 2:07 PM
    Man, it's really quiet in here isn't it
    o
    • 2
    • 1
  • m

    martmists

    07/29/2018, 2:25 PM
    Does ktor support creating zip files in memory only to send to the client? If not, how would I do that?
    d
    l
    • 3
    • 10
  • m

    martmists

    07/29/2018, 3:31 PM
    Is there a way to load the POST body without specifying the exact format, e.g. for Github webhooks, which post different formats? Or would I have to parse it manually
    c
    • 2
    • 1
  • v

    vincent.brule

    07/30/2018, 8:08 AM
    Hello, do you have a documentation page to render swagger documentation with ktor please ?
    ✅ 1
    d
    • 2
    • 31
Powered by Linen
Title
v

vincent.brule

07/30/2018, 8:08 AM
Hello, do you have a documentation page to render swagger documentation with ktor please ?
✅ 1
d

Deactivated User

07/30/2018, 9:08 AM
The most similar thing I’m aware of, is this issue: https://github.com/ktorio/ktor/issues/453
v

vincent.brule

07/30/2018, 9:14 AM
Thank for your answer. But if I have already the swagger json file, is it possible to send swagger ui and the json to the client to render it ?
d

Deactivated User

07/30/2018, 9:22 AM
There is an experimental swagger support for creating ktor projects: https://kotlinlang.slack.com/archives/C0A974TJ9/p1531889740000139?thread_ts=1531889740.000139
v

vincent.brule

07/30/2018, 10:13 AM
I tried your solution with a swagger json 2.0 but that doesn’t work... nothing ça generated for swagger rendering
d

Deactivated User

07/30/2018, 10:14 AM
any error?
it’s experimental, but as far as I know if something is not supported an exception is thrown
v

vincent.brule

07/30/2018, 10:25 AM
No error just the swagger rendering not in the project generated. I will try another solution, how do you render html file and css please ? Just call.respondFile not work for this
d

Deactivated User

07/30/2018, 10:26 AM
That’s strange. Would be nice to troubleshoot. For HTML: https://ktor.io/features/templates/html-dsl.html A guide for creating a website rendering HTML here: https://ktor.io/quickstart/guides/website.html
v

vincent.brule

07/30/2018, 10:26 AM
I tried this call.respondFile(File(“documentationSwagger/index.html”)) but the file is not send...
d

Deactivated User

07/30/2018, 10:27 AM
an exception thrown?
That file exists?
v

vincent.brule

07/30/2018, 10:27 AM
No error I just received this {“result”: “documentationSwagger/index.html”} instead of the file
d

Deactivated User

07/30/2018, 10:28 AM
That looks strange
v

vincent.brule

07/30/2018, 10:28 AM
I have seen this page but it’s to create html in ktor. In my case I have already the file so I just wamt to send it 🙂
d

Deactivated User

07/30/2018, 10:29 AM
yep, that makes sense, respondFile should work
v

vincent.brule

07/30/2018, 10:29 AM
I have this : suspend fun ApplicationCall.respondSuccessJson(answer: Any, code: HttpStatusCode = HttpStatusCode.OK) = respondText(“”"{“result”: $answer}“”", ContentType.parse(“application/json”), code) so it’s like send file use this…
instead of send the file
d

Deactivated User

07/30/2018, 10:30 AM
tyr with
call.respondText(“hello”) to see if you are entering the right route?
v

vincent.brule

07/30/2018, 10:31 AM
Yes that works, I receive only hello in this case
d

Deactivated User

07/30/2018, 10:32 AM
and…
call.respondText(File("…").readText())
?
v

vincent.brule

07/30/2018, 10:35 AM
Ok you have right, ktor didn’t find the file because in this case I received no such file or directory… I will try to change the path
d

Deactivated User

07/30/2018, 10:35 AM
okay
v

vincent.brule

07/30/2018, 10:36 AM
Just another question, if I have to send js, css and html file, I need to start by which one please ?
d

Deactivated User

07/30/2018, 10:36 AM
I think I do not understand the question
usually the user request an html
that html references js and css and those files are downloaded
For that, normally you would use the static files feature: https://ktor.io/features/static-content.html
to map a local folder to a url path
v

vincent.brule

07/30/2018, 10:37 AM
Ok I understand, thank you again for your help !
😒imple_smile: 1
👌 1
d

Deactivated User

08/03/2018, 9:59 PM
Related to the swagger issue you had, I guess you were using windows: https://github.com/ktorio/ktor/issues/499#issuecomment-410365863 It should be fixed in the next version that will probably come next week 🙂
👍 1
View count: 2