github-actions[bot] on gh-pages
deploy: 8a97d89e13db1c752ff1b47… (compare)
armanbilge on series
armanbilge on 0.23
Update jawn-parser to 1.4.0 in … Merge pull request #6513 from h… (compare)
http4s-steward[bot] on series
Update jawn-parser to 1.4.0 in … (compare)
github-actions[bot] on gh-pages
deploy: bc2f3d5e075ad289c68ac58… (compare)
rossabaker on 0.23.13
Merge branch '0.22' into 0.23 http4s-0.23.13 (compare)
armanbilge on 1.0.0-M34-1
rossabaker on main
Release v1.0.0-M34 Merge pull request #6512 from h… (compare)
rossabaker on 0.22
http4s-0.22.14 Merge pull request #279 from ht… (compare)
implicitNotFound
does not work (if it fails the implicit search you simply do not trigger the conversion)
def yolo = logMe[IO]("hello")
// scala> yolo.unsafeRunSync
// hello
def well = logMe("hello")
Users/fabio/projects/playground/src/main/scala/Playground.scala:57: Specify `IO` there: `logMe[IO]("hello")`
[error] def well = logMe("hello")
def logMe[F[_]]: Magnet[F] = new Magnet[F]
class Magnet[F[_]]
trait LowPrio {
@annotation.implicitNotFound("""Specify `IO` there: `logMe[IO]("hello")`""")
trait Error
class Catch[F[_]] {
def apply(s: String, logAction: String => F[Unit] = ???)(implicit ev: Error) =
???
}
implicit def conv2[F[_]](m: Magnet[F]): Catch[F] =
new Catch[F]
}
object Magnet extends LowPrio {
implicit def conv[F[_]: Sync](m: Magnet[F]): LogMePartiallyApplied[F] =
new LogMePartiallyApplied[F]
class LogMePartiallyApplied[F[_]: Sync] {
def apply(s: String, logAction: String => F[Unit] = { s =>
Sync[F].delay(println(s))
}) =
logAction(s)
}
}
enjoy
HttpRoutes.of
return org.http4s.package$#HttpRoutes
which is type HttpRoutes[F[_]] = Http[OptionT[F, ?], F]
with Http
being type Http[F[_], G[_]] = Kleisli[F, Request[G], Response[G]]
Request[G]
and Response[G]
with the same effect - but my request is supposed to work with IO and the response should be a stream.
Try(SSLContext.getDefault()).toOption
. The question is whether to log a warning that the default failed.
aws4s
but I'm not convinced that I want to base my api client on their model, and I don't know to what extent the signing can be abstracted out
trait Client takes type parameters
def foo(client: Client[IO]) : IO[String] = ...
Hi, is there way in http4s to get the app route or authority for incoming requests? Basically we have an app which needs to generate previous/next links and we would like to know the route that it is running on.
println(request.uri.authority)
always prints None. So we are having to pass the route as a config parameter and then recreate the link like:
(appApi.baseUri / "blah").copy(query = request.uri.query)
Any other suggestions? It seems a bit odd to have to pass your own route.
@scalolli , Request.uri
probably represents Request-URI
part of the query, which is usually just the absolute path. So it makes sense the authority
is None
.
However, HTTP 1.1-compliant clients should provide this information in another way. RFC 2616:
The most common form of Request-URI is that used to identify a resource on an origin server or gateway. In this case the absolute path of the URI MUST be transmitted (see section 3.2.1, abs_path) as the Request-URI, and the network location of the URI (authority) MUST be transmitted in a Host header field.
Also, depending on your use case, you might want to take a look at the VirtualHost
middleware.
Hi I'm working with 0.21.0-SNAPSHOT and permanently getting a JSON parse error for a simple JSON parsing example. Here's my code:
it("work with json") {
val body = json"""
{
"id" : 33 ,
"url" :"/testUrl" ,
"title" :"One" ,
"completed" : false ,
"order" : "None"
}"""
val req = request[TodoTask](Method.POST, "/").withEntity(body)
...
}
And this gives me an error:
Fiber failed.
A checked error was not handled.
org.http4s.MalformedMessageBodyFailure: Malformed message body: Invalid JSON
at org.http4s.circe.CirceInstances$.$anonfun$defaultCirceParseError$1(CirceInstances.scala:179)
at cats.syntax.EitherOps$.leftMap$extension(either.scala:144)
at org.http4s.circe.CirceInstances.$anonfun$jsonDecoderByteBufferImpl$1(CirceInstances.scala:37)
at scala.util.Either.flatMap(Either.scala:341)
Any ideas ?