Skip to content

Commit

Permalink
Merge pull request #54 from damjad/master
Browse files Browse the repository at this point in the history
Fix Issues in webservice quickstart
  • Loading branch information
khajavi authored May 20, 2024
2 parents aab319b + 9597fab commit f38e4eb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ object DownloadRoutes:
Header.ContentType(MediaType.application.`octet-stream`),
Header.ContentDisposition.attachment(fileName)
),
body = Body.fromStream(ZStream.fromResource(fileName))
body = Body.fromStreamChunked(ZStream.fromResource(fileName))
)
},

Expand All @@ -35,7 +35,7 @@ object DownloadRoutes:
Header.ContentType(MediaType.application.`octet-stream`),
Header.ContentDisposition.attachment(file)
),
body = Body.fromStream(
body = Body.fromStreamChunked(
ZStream
.fromResource(file)
.schedule(Schedule.spaced(50.millis))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,12 @@ object GreetingRoutes:
if (req.url.queryParams.nonEmpty)
ZIO.succeed(
Response.text(
s"Hello ${req.url.queryParams("name").map(_.mkString(" and "))}!"
s"Hello ${req.url.queryParams("name").reduce((x, y) => x + " and " + y)}!"
)
)
else
ZIO.fail(Response.badRequest("The name query parameter is missing!"))
ZIO.succeed(Response.text(s"Hello World!"))
},

// GET /greet
Method.GET / "greet" -> handler(Response.text(s"Hello World!")),

// GET /greet/:name
Method.GET / "greet" / string("name") -> handler {
(name: String, _: Request) =>
Expand Down

0 comments on commit f38e4eb

Please sign in to comment.