diff --git a/.deder/server.properties b/.deder/server.properties deleted file mode 100644 index 46af699d..00000000 --- a/.deder/server.properties +++ /dev/null @@ -1,3 +0,0 @@ -version=v0.0.21 - -#logLevel=debug diff --git a/deder.pkl b/deder.pkl index 78c14c9c..eff3af3a 100644 --- a/deder.pkl +++ b/deder.pkl @@ -1,4 +1,4 @@ -amends "https://sake92.github.io/deder/config/DederProject.pkl" +amends "https://sake92.github.io/deder/config/v0.2.3/DederProject.pkl" local const function pomSettings( _artifactId: String, @@ -172,12 +172,6 @@ local const sharafCoreModules = testTemplate = (sharafCoreTemplate.asTest()) { deps { "org.scalameta::munit::1.1.0" } } - jsTemplate = (sharafCoreTemplate.asJs()) { - scalaJsVersion = versions.scalaJsVersion - } - jsTestTemplate = (jsTemplate.asTest()) { - deps { "org.scalameta::munit::1.1.0" } - } nativeTemplate = (sharafCoreTemplate.asNative()) { scalaNativeVersion = versions.scalaNativeVersion moduleDeps { @@ -228,19 +222,36 @@ local const sharafUndertowModules = }.get local const sharafHttp4sModules = - new CreateScalaModules { + new CreateCrossModules { root = "sharaf-http4s" + local const _pomSettings = + pomSettings("sharaf-http4s", "Sharaf Http4s", "Sharaf integration with Http4s") template = (baseTemplate) { - pomSettings = pomSettings("sharaf-http4s", "Sharaf Http4s", "Sharaf integration with Http4s") - moduleDeps { - sharafCoreModules.jvm - } - deps { "org.http4s::http4s-server::0.23.32" } + pomSettings = _pomSettings + moduleDeps { sharafCoreModules.jvm } + deps { "org.http4s::http4s-server::0.23.34" } } testTemplate = (baseTemplate.asTest()) { deps { "org.scalameta::munit::1.1.0" - "org.http4s::http4s-client::0.23.32" + "org.http4s::http4s-client::0.23.34" + } + } + nativeTemplate = (baseTemplate.asNative()) { + scalaNativeVersion = versions.scalaNativeVersion + pomSettings = _pomSettings + moduleDeps { sharafCoreModules.native } + deps { + "org.http4s::http4s-server::0.23.34" + "com.lihaoyi::sourcecode::0.4.2" + "io.github.cquiroz::scala-java-time::2.6.0" + } + } + nativeTestTemplate = (nativeTemplate.asTest()) { + multithreading = true + deps { + "org.scalameta::munit::1.1.0" + "org.http4s::http4s-client::0.23.34" } } }.get @@ -403,7 +414,7 @@ local const http4sExampleModules = new CreateScalaModules { root = "examples/http4s" template = (baseExampleTemplate) { - moduleDeps { sharafHttp4sModules.main } + moduleDeps { sharafHttp4sModules.jvm } deps { "org.http4s::http4s-ember-server::0.23.32" } } testTemplate = (baseExampleTemplate.asTest()) { @@ -425,7 +436,10 @@ modules { sharafCoreModules.native sharafCoreModules.native_test ...sharafUndertowModules.all - ...sharafHttp4sModules.all + sharafHttp4sModules.jvm + sharafHttp4sModules.jvm_test + sharafHttp4sModules.native + sharafHttp4sModules.native_test ...sharafHelidonModules.all ...sharafJdkHttpserverModules.all sharafSnunit @@ -438,3 +452,4 @@ modules { ...snunitExampleModules.all ...http4sExampleModules.all } + diff --git a/examples/api/test/src/JsonApiSuite.scala b/examples/api/test/src/JsonApiSuite.scala index 525c58bb..55659bd5 100644 --- a/examples/api/test/src/JsonApiSuite.scala +++ b/examples/api/test/src/JsonApiSuite.scala @@ -75,7 +75,6 @@ class JsonApiSuite extends munit.FunSuite { } // filtering GET - // TODO reenable locally { val queryParams = ProductsQuery(Set("Chocolate"), Option(1)).toSttpQuery() val res = quickRequest.get(uri"$baseUrl/products".withParams(queryParams)).send() diff --git a/sharaf-http4s/src/ba/sake/sharaf/http4s/SharafHttpApp.scala b/sharaf-http4s/src/ba/sake/sharaf/http4s/SharafHttpApp.scala index 4a8ba98e..cc935c90 100644 --- a/sharaf-http4s/src/ba/sake/sharaf/http4s/SharafHttpApp.scala +++ b/sharaf-http4s/src/ba/sake/sharaf/http4s/SharafHttpApp.scala @@ -30,12 +30,16 @@ def SharafHttpApp(sharafHandler: SharafHandler) = Seq.empty // TODO: remove header })) - body <- IO.pure(response.body match { + body <- response.body match { case Some(body) => - fs2.io.readOutputStream(4096)(outputStream => IO.blocking(response.rw.write(body, outputStream))) + IO.blocking { + val baos = new java.io.ByteArrayOutputStream() + response.rw.write(body, baos) + fs2.Stream.emits[IO, Byte](baos.toByteArray()) + } case None => - fs2.Stream.empty[IO] - }) + IO.pure(fs2.Stream.empty[IO]) + } response <- IO.pure( Http4sResponse[IO](