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
1 answer

How to decode a Json with a root array?

I'm having some trouble figuring out how to decode a json with a root array into a case class using json4s-jackson library. The purpose of extracting directly into a case-class and not into a Seq[Username] is to validate the existence of a single…
Dmitry
  • 778
  • 8
  • 10
0
votes
1 answer

Runtime Configuration of Cassandra connection in Phantom DSL

I'm using phantom to connect to Apache Cassandra and want to configure the connector at runtime, i.e. I want to parse some configuration file, extract a list of Cassandra databases and pass that somehow to my Database object. I followed this guide…
Thomas Bach
  • 103
  • 7
0
votes
2 answers

Upgrading Http4s to 0.18: StaticFile and fallthrough/pass

In Http4s 0.16.6a, I had the following service. import org.http4s.server.staticcontent._ import org.http4s._ object StaticFiles { val basepath = ... def apply(): HttpService = Service.lift(request => { val file = basepath +…
Toby
  • 9,523
  • 8
  • 36
  • 59
0
votes
1 answer

FS2 Running streams in sequence

I have a fairly simple use case. I have two web service calls one fetches products and another fetches relationship. I want to run fetchProducts() first extract a field from the set of products and then pass the output to fetchRelationships(ids:…
0
votes
1 answer

Add exception handling in http4s with rho

I'm using http4s & rho (mainly for Swagger integration) My services are using this DAO object, that methods that can throw Exceptions (fail the Task) case class BasicMatchDao() { def readAll(): Task[List[BasicMatch]] =…
Tom Lous
  • 2,819
  • 2
  • 25
  • 46
0
votes
2 answers

Await.result on HttpService

I've a scala project with http4s 0.15.16a and slick 3.2.1 with these steps: Receive a ID by rest call passing ID to MySlickDAO that responds with a Future Call Await.result(res, Duration.Inf) on Future returned by MySlickDAO Create the json The…
gekomad
  • 525
  • 9
  • 17
0
votes
0 answers

mod_ntlm with Camel http4 component

Hi all, Is there known limitations with using the Camel http4 component to authenticate to a mod_ntlm protected endpoint? In our Camel service, I am able to successfully authentication to NTLM protected endpoints which is protected using jcifs…
Gary O' Donoghue
  • 362
  • 2
  • 4
  • 15
0
votes
1 answer

How to mount a servlet filter in blaze server (http4s)

I am a newbie in scala world and using http4s for developing the REST layer of my application. I am using blaze server for deploying/publishing the services. I need to mount a servlet filter or interceptor in the flow before it reaches my…
0
votes
1 answer

http4s, Service Executor and Mongodb: How can I wait for insertOne to finish

Apologies in advance for the basic question. I am starting to learn Scala with http4s and in a router handler, I am trying to enter an entry to MongoDB. As far as I can tell insertOne returns a Observable[Completed]. Any idea how I can wait for the…
user6307701
0
votes
3 answers

https4s how to make a POST call to a REST web service

I am trying to use the http4s library. I am trying to make a POST request to a REST web service with some json payload. when I read the documentation http://http4s.org/docs/0.15/ I can only see a GET method example. does anyone know how to make a…
Knows Not Much
  • 30,395
  • 60
  • 197
  • 373
-2
votes
3 answers

entity decode for json that return a list/seq of any val

I am building the back-end of an app using http4s. In the app i receive a json response from an external api (not the one i am working on). The api response is of this pattern below. json response: `{ "datatable" : { "data" :…
1 2 3
10
11