File tree Expand file tree Collapse file tree 2 files changed +16
-6
lines changed
core/src/main/scala/org/http4s Expand file tree Collapse file tree 2 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -56,4 +56,10 @@ object HttpRoutes {
5656 */
5757 def of [F [_]](pf : PartialFunction [Request [F ], F [Response [F ]]])(implicit F : Sync [F ]): HttpRoutes [F ] =
5858 Kleisli (req => OptionT (F .delay(pf.lift(req).sequence).flatten))
59+
60+ /** An empty set of routes. Always responds with `pOptionT.none`.
61+ *
62+ * @tparam F the base effect of the [[HttpRoutes ]]
63+ */
64+ def empty [F [_]: Applicative ]: HttpRoutes [F ] = liftF(OptionT .none)
5965}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ package org.http4s
33import cats ._
44import cats .data ._
55
6+ @ deprecated(" Replaced by HttpRoutes" , " 0.19" )
67object HttpService extends Serializable {
78
89 /**
@@ -14,14 +15,17 @@ object HttpService extends Serializable {
1415 def lift [F [_]: Functor ](f : Request [F ] => F [Response [F ]]): HttpService [F ] =
1516 Kleisli (f.andThen(OptionT .liftF(_)))
1617
17- /** Lifts a partial function to an `HttpService`.
18- * Responds with `OptionT.none` for any request where `pf` is not defined.
18+ /** Lifts a partial function to [[HttpRoutes ]]. Responds with
19+ * `OptionT.none` for any request where `pf` is not defined.
20+ *
21+ * Unlike `HttpRoutes.of`, does not suspend the application of `pf`.
1922 */
23+ @ deprecated(" Replaced by `HttpRoutes.of`" , " 0.19" )
2024 def apply [F [_]](pf : PartialFunction [Request [F ], F [Response [F ]]])(
21- implicit F : Applicative [F ]): HttpService [F ] =
25+ implicit F : Applicative [F ]): HttpRoutes [F ] =
2226 Kleisli (req => pf.andThen(OptionT .liftF(_)).applyOrElse(req, Function .const(OptionT .none)))
2327
24- def empty [ F [_] : Applicative ] : HttpService [ F ] =
25- Kleisli .liftF( OptionT .none)
26-
28+ @ deprecated( " Replaced by `HttpRoutes. empty` " , " 0.19 " )
29+ def empty [ F [_] : Applicative ] : HttpRoutes [ F ] =
30+ HttpRoutes .empty
2731}
You can’t perform that action at this time.
0 commit comments