https://kotlinlang.org logo
Title
r

Rob Elliot

01/18/2022, 2:04 PM
Does anyone know of a common interface over an Http4K
HttpHandler
& the browser fetch API that would allow using the same code to make HTTP requests in the browser and the server?
c

christophsturm

01/18/2022, 2:06 PM
ktor has a http client that works on the jvm and in js
r

Rob Elliot

01/18/2022, 2:07 PM
Thanks - I was wondering if the same could be done for http4k or if the async model would be too much of an impedance.
c

christophsturm

01/18/2022, 2:42 PM
i guess the hardest part would be to convince the http4k maintainers to make http4k-core into a multiplatform project
r

Rob Elliot

01/18/2022, 2:45 PM
I was thinking more of a separate multiplatform interface, and implementing it on the serverside with Http4K and on the client side with the fetch API
But probably copying most (all?) of the Http4K interfaces to do it
c

christophsturm

01/18/2022, 2:49 PM
or you could make it just inspired by http4k, but with
suspend
p

Peter

01/18/2022, 3:41 PM
wish they would reevaluate their stance on suspending functions in the main interface now that their concern is no longer valid with 1.6
👍 1
r

Rob Elliot

01/18/2022, 3:43 PM
What was their concern, and why is it no longer valid? Never mind, found https://github.com/http4k/http4k/issues/94#issuecomment-961746958
👍 1