Skip to content

Commit

Permalink
Merge pull request #83 from innFactory/fix/BodySizeLog
Browse files Browse the repository at this point in the history
fix: adding error log when body size does not equal the parsed body size
  • Loading branch information
patsta32 authored Dec 8, 2022
2 parents b7b4a31 + c524f35 commit 547cebe
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sbt.Compile
import sbt.Keys.cleanFiles
val releaseVersion = sys.env.getOrElse("TAG", "0.2.3-BETA.3")
val releaseVersion = sys.env.getOrElse("TAG", "0.2.3-BETA.6")
addCommandAlias("publishSmithy4Play", "smithy4play/publish")
addCommandAlias("publishLocalSmithy4Play", "smithy4play/publishLocal")
addCommandAlias("generateCoverage", "clean; coverage; test; coverageReport")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,13 @@ class SmithyPlayEndpoint[Alg[_[_, _, _, _, _]], F[_] <: ContextRoute[_], Op[
def handler(v1: RequestHeader): Handler =
httpEndpoint.map { httpEp =>
Action.async(parse.raw) { implicit request =>
if (request.body.size > 0 && request.body.asBytes().isEmpty) {
logger.error(
"received body size does not equal the parsed body size. \n" +
"This is probably due to the body being too large and thus play is unable to parse.\n" +
"Try setting play.http.parser.maxMemoryBuffer in application.conf"
)
}
val result: EitherT[Future, ContextRouteError, O] = for {
pathParams <- getPathParams(v1, httpEp)
metadata = getMetadata(pathParams, v1)
Expand Down
3 changes: 1 addition & 2 deletions smithy4playTest/conf/application.conf
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
# https://www.playframework.com/documentation/latest/Configuration


play.http.parser.maxDiskBuffer = 100MB
play.http.parser.maxMemoryBuffer=100MB
parsers.anyContent.maxLength = 100MB

play.filters.enabled = []

smithy4play.autoRoutePackage = "controller"
Expand Down

0 comments on commit 547cebe

Please sign in to comment.