-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Request hanging on multipartBody file uploads with zio-http #2518
Comments
Checked with adopt-tapir's generated projects with ZIO and zio-http vs http4s server implementations, replacing package com.softwaremill
import sttp.tapir._
import sttp.tapir.ztapir.ZServerEndpoint
import zio.ZIO
import sttp.model.Part
import sttp.tapir.generic.auto._
object Endpoints {
case class UploadForm(file: Part[TapirFile])
val helloEndpoint: PublicEndpoint[UploadForm, Unit, String, Any] = endpoint.post
.in("hello")
.in(multipartBody[UploadForm])
.out(stringBody)
val helloServerEndpoint: ZServerEndpoint[Any, Any] = helloEndpoint.serverLogicSuccess(user => ZIO.succeed(s"Hello $user"))
val apiEndpoints: List[ZServerEndpoint[Any, Any]] = List(helloServerEndpoint)
val all: List[ZServerEndpoint[Any, Any]] = apiEndpoints
} the zio-http version hangs:
while http4s version runs ok:
|
That's probably because multipart isn't supported by the zio-http interpreter: https://github.com/softwaremill/tapir/blob/master/server/zio-http-server/src/main/scala/sttp/tapir/server/ziohttp/ZioHttpRequestBody.scala#L28 I think there was some missing functionality in zio-http which prevented us from implementing this, but maybe it's possible now. Either way, I'll change this to throw an exception instead of silently failing. |
Exception is good as we can test for it in our test suites and know when support will be added :) Thanks |
It seems that ZIO-HTTP support for multipart is still work in progress - zio/zio-http#1617, so we will have to wait for now. |
It seems that ZIO-HTTP supports multipart/form-data in 0.0.5. There is an example in zio/zio-http#2037 |
@akizminet Awesome :) Now we need somebody to volunteer to add multipart support to tapir+zio :) |
I would like to volunteer: Currently this PR is in Draft because:
|
@seakayone Awesome! There are some multipart tests which can be enabled for the zio http interpreter: https://github.com/softwaremill/tapir/blob/master/server/zio-http-server/src/test/scala/sttp/tapir/server/ziohttp/ZioHttpServerTest.scala#L263, so this might give some guidance |
Thanks @adamw I have activated the tests and am currently struggling with zio-http. The incoming |
@seakayone Any news on this perhaps? |
My PR for tapir cannot be merged as there is bug in zio-http zio/zio-http#2411 which I haven't been able to fix. |
Any news on this? zio/zio-http#2411 got merged |
Hi, same question, is somebody actively working on this? |
I am planning to finalize the PR (#3690) in the next couple of days hopefully. |
PR (#3690) is ready for review. |
Tapir version: 1.1.3
Scala version: 2.13.10
I'm defining the endpoint and server logic like this:
then making zio-http server:
Then starting the server and uploading a file with curl command:
Server logs only this:
And curl times out not receiving anything.
The text was updated successfully, but these errors were encountered: