File tree Expand file tree Collapse file tree 2 files changed +8
-4
lines changed
main/scala/io/github/howardjohn/lambda/http4s
test/scala/io/github/howardjohn/lambda/http4s Expand file tree Collapse file tree 2 files changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import org.http4s._
88
99import scala .util .Try
1010
11- class Http4sLambdaHandler (service : HttpService [IO ]) extends LambdaHandler {
11+ class Http4sLambdaHandler (service : HttpRoutes [IO ]) extends LambdaHandler {
1212 import Http4sLambdaHandler ._
1313
1414 override def handleRequest (request : ProxyRequest ): ProxyResponse =
Original file line number Diff line number Diff line change @@ -7,13 +7,15 @@ import io.github.howardjohn.lambda.LambdaHandlerBehavior
77import io .github .howardjohn .lambda .LambdaHandlerBehavior ._
88import org .http4s .circe ._
99import org .http4s .dsl .io ._
10- import org .http4s .{Header , HttpService }
10+ import org .http4s .{EntityDecoder , Header , HttpRoutes }
1111import org .scalatest .{FeatureSpec , GivenWhenThen }
1212
1313class Http4sLambdaHandlerSpec extends FeatureSpec with LambdaHandlerBehavior with GivenWhenThen {
14- implicit val jsonDecoder = jsonOf[IO , JsonBody ]
14+ implicit val jsonDecoder : EntityDecoder [IO , JsonBody ] = jsonOf[IO , JsonBody ]
15+
1516 object TimesQueryMatcher extends OptionalQueryParamDecoderMatcher [Int ](" times" )
16- val route = HttpService [IO ] {
17+
18+ val route : HttpRoutes [IO ] = HttpRoutes .of[IO ] {
1719 case GET -> Root / " hello" :? TimesQueryMatcher (times) =>
1820 Ok {
1921 Seq
@@ -29,6 +31,8 @@ class Http4sLambdaHandlerSpec extends FeatureSpec with LambdaHandlerBehavior wit
2931 case req @ POST -> Root / " post" => req.as[String ].flatMap(s => Ok (s))
3032 case req @ POST -> Root / " json" => req.as[JsonBody ].flatMap(s => Ok (LambdaHandlerBehavior .jsonReturn.asJson))
3133 }
34+
3235 val handler = new Http4sLambdaHandler (route)
36+
3337 scenariosFor(behavior(handler))
3438}
You can’t perform that action at this time.
0 commit comments