Questions tagged [http4s]

Http4s is a minimal, idiomatic Scala interface for HTTP services.

http4s is a typeful, purely functional HTTP library for client and server applications written in Scala.

Principles

Typeful: http4s uses Scala’s type system to increase self-documentation and compile-time verification. Standard headers are lazily parsed to semantically meaningful types, and typeclasses are provided to encode and decode bodies to several common formats.

Purely functional: The pure functional side of Scala is favored to promote composability and easy reasoning about your code. The core is built on an immutable case class model of HTTP requests and responses, shared by the client and the server.

Asynchronous: Much of the API is built around a scalaz.concurrent.Task. Bodies are modeled as scalaz-streams for performant chunking of large messages in constant memory.

Modular: http4s has a lightweight core with multiple deployment options. Server applications can be deployed to blaze, the native platform, or as a servlet application. Client applications run on either blaze or an async-http-client backend. Several libraries useful in everyday HTTP programming, such as circe and argonaut, are integrated via optional modules.

Community-oriented: http4s is a community-driven project, and aims to provide a welcoming environment for all users. We are proud to be a Typelevel incubator project.

Official website: http://http4s.org/

161 questions
0
votes
0 answers

http4s configuration from spring cloud config server

We have a rest microservice developed using scala http4s. We want to externalize configuration for this microservice like we do in spring boot ecosystem. Can this be done in Scala Http4s where they can refer a spring cloud config server? Is there…
azaveri7
  • 793
  • 3
  • 18
  • 48
0
votes
1 answer

A journey from akka-stream to fs2 - how to define an akka-stream http flow like stage in fs2 using http4s

i'm on my journey to deepen my knowledge in fs2, and want to try fs2-kafka for a use case where i would replace akka stream. The idea is simple, read from kafka and post data via http request to a sink, then commit back to kafka on success. So far…
MaatDeamon
  • 9,532
  • 9
  • 60
  • 127
0
votes
1 answer

How to configure tomcat in http4s

I wonder if there is any option to configure tomcat when using http4s server API. Tomcat builder allows to change some basic options, but besides those there is no much what can be set. Could I somehow provide a server.xml file? Or get access to…
slovvic
  • 417
  • 3
  • 6
  • 14
0
votes
2 answers

Apache camel route a URI to another URI

Is it possible to route all of request to another server directly? For example route all of this project specific rest endpoint localhost:8080/get-something to another project endpoint like this: someIp:8081/get-something2 . something like…
primElite
  • 11
  • 2
0
votes
1 answer

Filtering a collection of IO's: List[IO[Page]] scala

I am refactoring a scala http4s application to remove some pesky side effects causing my app to block. I'm replacing .unsafeRunSync with cats.effect.IO. The problem is as follows: I have 2 lists: alreadyAccessible: IO[List[Page]] and pages:…
gutscdav000
  • 359
  • 1
  • 3
  • 14
0
votes
2 answers

http4s using double quotes and braces in uri

I can't found a solution, how to build this uri import org.http4s._ import org.http4s.implicits.http4sLiteralsSyntax val uriFoll: Uri =…
Aleksey N Yakushev
  • 443
  • 1
  • 3
  • 11
0
votes
1 answer

How to get Http[F] out of the context F?

I am trying to run my webapp that is based on http4s on jetty. The http4s library provides AsyncHttp4sServlet[IO] class to extend and I use as follows: class UserSvcServlet extends AsyncHttp4sServlet[IO]( service = UserSvcServer.start, …
softshipper
  • 32,463
  • 51
  • 192
  • 400
0
votes
1 answer

Jetty error: HTTP method GET is not supported by this URL

I am using HTTP4S and the webapp is running on jetty. The web app file is configured as:
softshipper
  • 32,463
  • 51
  • 192
  • 400
0
votes
1 answer

Why does it show Jetty?

I have built my web app with https://http4s.org/: object UserSvcServer { def stream[F[_]: ConcurrentEffect](implicit T: Timer[F], C: ContextShift[F]): Stream[F, Nothing] = { val helloWorldAlg = HelloWorld.impl[F] val httpApp = ( …
softshipper
  • 32,463
  • 51
  • 192
  • 400
0
votes
1 answer

How to handle a basic form submission with http4s?

I can't believe this isn't in the http4s documentation, and the example code I was able to dig up online (after poking around long enough to discover the UrlForm class) is not working for me. The relevant bit of code looks like this: case req @ POST…
Chris W.
  • 1,680
  • 16
  • 35
0
votes
0 answers

Unit testing http4s with scalatest

o/ I am trying to implement a client for the API of cex.io in Scala. Because I like functional programming (or I think I do), I try to do this by using the http4s library. This is some experimental code: class CexApi { val baseUrl: String =…
Aarkon
  • 484
  • 1
  • 6
  • 16
0
votes
1 answer

How do I know, which implicit that is needs?

I have a working code: final case class Services[F[_]](c: Client[F], fooUrl: String) (implicit cf: ConcurrentEffect[F]) { private val dsl = Http4sDsl[F] import dsl._ def routes: HttpRoutes[F] =…
softshipper
  • 32,463
  • 51
  • 192
  • 400
0
votes
1 answer

Understand how HTTP server and lclient understand the media type of a request

I have written an http4 client to push Json data up to a server that will take the http request or post. now, my code works on some systems and not on others? and I do not know where the problem lies. is it the server or the client. below is the…
GLMills
  • 558
  • 1
  • 12
  • 37
0
votes
1 answer

value decode is not a member of org.http4s.AuthedRequest

I am using http4s version 0.18, with Circe and I am getting the error value decode is not a member of org.http4s.AuthedRequest when I converting the json body to a case class within an AuthedService with the following code: // case class…
Valy Dia
  • 2,781
  • 2
  • 12
  • 32
0
votes
1 answer

Http-Request in Apache Camel

I want to save the content from a localhost(json data) Example: "id": 1, "prename": "Noel", "surname": "Reyes", "dateOfBirth": "1988-09-07", "birthPlace": "Bad Ems", "gender": "M"} ) in a txt.file (C:\inputFolder in…
user10718437
1 2 3
10
11