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

    James Richardson

    12/02/2020, 7:27 PM
    You need to ensure that you import the correct Body auto, the one from your Jackson not the standard one
    🙏 1
    👍 1
    r
    • 2
    • 1
  • d

    dave

    12/02/2020, 8:24 PM
    @Razvan if you get too annoyed with it you can also call CustomJackson.autoBody()
    r
    v
    • 3
    • 3
  • v

    Vojtěch Knyttl

    12/06/2020, 7:22 AM
    I am trying to extract better error message from Jackson deserialization of request Body - within
    Filter
    implemented in the example I am only getting
    400 BAD REQUEST
    whereas Jackson provides a nice error description. Is it possible to get this very description to log within the logging filter? https://gist.github.com/knyttl/bd0ffe5474e14a9e64f71d78249bac5b
    d
    • 2
    • 32
  • v

    Vojtěch Knyttl

    12/07/2020, 7:25 PM
    was there something changed with (un)escaping of input params in recent versions? consider
    field=foo|bar
    as input to
    Path.string().of("field")
    - browsers normally escape
    foo|bar
    to
    foo%7Cbar
    which in 249 always arrived as
    foo|bar
    to the controller. Now it arrives as
    foo%7Cbar
    . I can prepare a demo if it helps.
    d
    e
    • 3
    • 6
  • v

    Vojtěch Knyttl

    12/10/2020, 5:58 AM
    is there a way to use data validation api – it allows to define constraints for OpenApi as well as validating input parameters:
    data class UpdateRequest(
            @get:Size(min = 0, max = 64)
            val name: String?,
            @get:Size(min = 0, max = 512)
            val bio: String?,
        )
    d
    • 2
    • 10
  • s

    Sebastian Galkin

    12/23/2020, 7:15 PM
    Is
    Query.composite
    supposed to render in the OpenAPI documentation? I'm adding one of these to the meta with
    queries += Queries.composite {....}
    but it doesn't show up in the json output
    d
    • 2
    • 2
  • s

    Sebastian Galkin

    12/24/2020, 3:21 PM
    I want more detailed responses when there is a failure unmarshalling the request
    d
    • 2
    • 2
  • d

    dave

    01/07/2021, 7:50 PM
    👋🙃. @andyg All header lenses are bidi by default. Can you post a gist of what you're having trouble with
    a
    • 2
    • 9
  • d

    dave

    01/11/2021, 12:29 PM
    Hi Everyone! We've just released http4k 4.0.0.0 to the world. Here's the link to the Reddit post explaining what we've been up to: https://www.reddit.com/r/Kotlin/comments/kv1p8y/http4k_v4_released_17_platforms_and_counting
    🎉 14
    f
    x
    • 3
    • 2
  • q

    Quy D X Nguyen

    01/11/2021, 2:59 PM
    Is it possible to add routes to an existing RoutingHttpHandler?
    d
    • 2
    • 1
  • r

    Riku

    01/13/2021, 8:56 AM
    Is this fixable? https://github.com/Chesterdam/jackson_xml_problem/blob/master/src/main/kotlin/main.kt
    d
    • 2
    • 2
  • r

    Razvan

    01/15/2021, 10:01 AM
    Hi, I have several issues with ZipkinTraces. I'll post them in the thread.
    s
    • 2
    • 10
  • r

    Razvan

    01/15/2021, 10:42 AM
    And the second problem I have (I guess much harder) is with EventFilter.AddZipkinTraces on a client I expected it to have the client traces not the server ones. I guess is beacause it is lazy evaluated so the currentThread does no longer have the client data. here's a test that shows it
    s
    • 2
    • 3
  • r

    Razvan

    01/15/2021, 11:24 AM
    Do you have an example with using a
    Query.composite
    lens for injecting an object in the request, In the doc you give the example:
    val pageable = Query.composite {
            Pageable(
                boolean().defaulted("sortAscending", true)(it),
                int().defaulted("page", 1)(it),
                int().defaulted("maxResults", 20)(it)
            )
        }
    but it creates a Pageable object from the request. Is it possible to make it bidirectionnal and use the lens to inject these query parms from the object in order to use it like ?
    Response(OK).with(
               pageable of pageableObject
            )
    • 1
    • 1
  • f

    Fabian Braun

    01/15/2021, 2:45 PM
    Hi lens-experts. How would I define an EnvironmentKey which may hold a subset of predefined enum values?
    d
    • 2
    • 3
  • r

    Razvan

    01/16/2021, 4:08 PM
    Hello, shouldn't the GraphQL quide also list the
    implementation "com.expediagroup:graphql-kotlin-schema-generator:xxx"
    gradle dependency ??? As it is I thought it is added by graphql module and couldn't figure out why the guide exemple does not compile, But reading the github exemple I see it is a separate dependency that should be added.
    d
    • 2
    • 1
  • r

    Riku

    01/17/2021, 4:00 PM
    Upgraded to the latest version and am getting a runtime error Any idea why?
    d
    • 2
    • 1
  • r

    Razvan

    01/18/2021, 8:23 AM
    Does a Enum Lens like:
    Query.enum<EnumType>().required("type")
    is supposed to be translated as en enum type in OpenAPI3 specification ? Because it does not.
    d
    • 2
    • 3
  • r

    Razvan

    01/20/2021, 8:13 PM
    Hi, I'm playing with Caching HTTP Traffic example, I put breakpoints in DiskTree Sink but never stops. I changed a bit the response to show the current time to see if the second time it's the same but it does search the cache but the cache is always empty (as it does not enter the Sink function).
    fun main() {
        val storage = ReadWriteCache.Disk()
    
        val withCachedContent = TrafficFilters.ServeCachedFrom(storage).then { Response(OK).body("hello world: ${LocalDateTime.now()}") }
        val aRequest = Request(Method.GET, "<http://localhost:8000/>")
        println("--- FIRST ----")
        println(withCachedContent(aRequest))
    
        Thread.sleep(1000)
        println("--- SECOND ----")
        println(withCachedContent(aRequest))
    }
    I expected both output to show the same time and not different ones....
    d
    • 2
    • 8
  • s

    s4nchez

    01/21/2021, 2:49 PM
    That'll return null rather than blow up if request is not a
    RoutedRequest
    .
    c
    • 2
    • 5
  • d

    dave

    01/23/2021, 3:35 PM
    @Razvan thanks! and agreed - we generally find code generators to be a massive red flag as they are often abused, and we would never ever be mandated that library users need to use them. But we are quite lazy and the extension functions did seem to be worth the effort to give people a more familiar API. 🙂 . You can (hopefully!) expect a few articles in the next few months about the connect patterns. ..
    👍 1
    r
    • 2
    • 14
  • d

    DanielZ

    01/24/2021, 8:40 PM
    Don’t get it why CookieTests are failing? (Java 11 and german locale settings).
    CookieTest > cookie with various expires date formats parsed() FAILED
        java.lang.AssertionError at CookieTest.kt:215
    
    ClientCookiesTest > cookie expiry uses the same timezone as cookie parsing() FAILED
        java.lang.NullPointerException at ClientCookiesTest.kt:88
    When I run only “CookieTest > cookie with various expires date formats parsed()” test is passing - but running all tests it’s always failing. Any Ideas?
    v
    s
    • 3
    • 9
  • c

    Cosmin Victor Celea

    01/26/2021, 1:17 PM
    ava.lang.NoSuchMethodError: java.net.URLDecoder.decode(Ljava/lang/String;Ljava/nio/charset/Charset;)Ljava/lang/String;
    	at org.http4k.core.UriKt.toPathDecoded(Uri.kt:71)
    	at org.http4k.contract.ContractRouteKt$extract$1$1.invoke(ContractRoute.kt:93)
    	at org.http4k.contract.ContractRouteKt$extract$1$1.invoke(ContractRoute.kt)
    	at org.http4k.contract.ContractRouteKt.invoke(ContractRoute.kt:88)
    	at org.http4k.contract.ContractRouteKt.extract(ContractRoute.kt:93)
    	at org.http4k.contract.ContractRouteKt.access$extract(ContractRoute.kt:1)
    	at org.http4k.contract.ContractRoute$toRouter$1.match(ContractRoute.kt:46)
    	at org.http4k.contract.ContractRoutingHttpHandler.match(ContractRoutingHttpHandler.kt:92)
    	at org.http4k.routing.OrRouter.match(Router.kt:78)
    	at org.http4k.routing.RouterBasedHttpHandler.match(RouterBasedHttpHandler.kt)
    	at org.http4k.routing.RouterBasedHttpHandler.match(RouterBasedHttpHandler.kt)
    	at org.http4k.routing.RouterBasedHttpHandler.invoke(RouterBasedHttpHandler.kt:18)
    	at org.http4k.routing.RouterBasedHttpHandler.invoke(RouterBasedHttpHandler.kt:13)
    	at org.http4k.filter.ServerFilters$CatchAll$invoke$1$1.invoke(ServerFilters.kt:252)
    	at org.http4k.filter.ServerFilters$CatchAll$invoke$1$1.invoke(ServerFilters.kt:248)
    	at org.http4k.core.Http4kKt$then$2.invoke(Http4k.kt:15)
    	at org.http4k.core.Http4kKt$then$2.invoke(Http4k.kt)
    	at org.http4k.server.HttpUndertowHandler.handleRequest(Undertow.kt:41)
    	at io.undertow.server.Connectors.executeRootHandler(Connectors.java:387)
    	at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:841)
    	at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
    	at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2019)
    	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1558)
    	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1449)
    	at java.lang.Thread.run(Thread.java:748)
    s
    d
    • 3
    • 15
  • r

    Razvan

    02/02/2021, 5:52 PM
    hi, about http4k-connect do you see it as a way to interact with big api or you would use it for any internal client of the app. If it's the second, if your app calls multiple different services, would you write a connect for each one or you think is too much overhead ?
    d
    • 2
    • 3
  • m

    MrNiamh

    02/03/2021, 2:51 PM
    Hey guys 👋 hope you've been well, it's Niamh (from Bo)! I'm in a new role now, and we're using Spring Webflux 🤢 with netty , but the intention is to move to something else. I've of course mentioned Http4k, so just been reading a bit around migrating away. We can't/dont want to do a big migration, and would prefer to do it bit by bit. I saw this post, however it's more for mvc and not webflux, and I'm struggling to find something similar for webflux. Has anyone got any experience doing this migration from webflux? Any suggestions would be massively appreciated.
    r
    d
    • 3
    • 6
  • r

    Razvan

    02/03/2021, 6:42 PM
    Any idea how to make kapt (http4k-connect) generate the right return type ? I changed form
    Result<R. RemoteFailure>
    to
    Result<R, Response>
    but it keeps generating the extension action function with RemoteFailure. Cleaned hole project but still fails with:
    Type mismatch: inferred type is Result<LineAidResponse /* = Map<String, String> */, Response> but Result<Map<String, String>, RemoteFailure> was expected
    d
    • 2
    • 16
  • d

    dave

    02/05/2021, 9:57 AM
    If you're in the mood to witness some rather ninja live coding, then you should definitely try to make time for this... 🙃 https://fosdem.org/2021/schedule/event/live_coding_with_http4k/
    👍 1
    d
    r
    • 3
    • 3
  • d

    Daniel Skogquist Åborg

    02/06/2021, 4:05 PM
    What's going on with coroutines support? The issue is 3 years old and the latest comment is a comment wondering... What's going on with coroutines support? https://github.com/http4k/http4k/issues/94
    • 1
    • 1
  • d

    Daniel Skogquist Åborg

    02/07/2021, 1:47 AM
    I'm looking at the documentation, and correcting spelling errors. In a lot of cases the comments in the code examples clip to the right because the inlining window is too narrow. Is this intentional, i.e. one is supposed to scroll horizontally? (It's kind of annoying.)
    d
    • 2
    • 4
  • d

    Daniel Skogquist Åborg

    02/07/2021, 1:23 PM
    We seem to be lacking dynamic authentication in BasicAuthSecurity, which means you can't reuse the Security in the spec in the implementation in lieu of using the BasicAuth filter directly. PR welcome?
    d
    • 2
    • 1
Powered by Linen
Title
d

Daniel Skogquist Åborg

02/07/2021, 1:23 PM
We seem to be lacking dynamic authentication in BasicAuthSecurity, which means you can't reuse the Security in the spec in the implementation in lieu of using the BasicAuth filter directly. PR welcome?
d

dave

02/07/2021, 1:30 PM
If you come across something that is useful then absolutely PR it! 🙃 Probably worth calling through from the static construction to the dynamic one to keep the code dry
👍 1
View count: 10