Skip to content

Commit

Permalink
Formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
mkurz committed Apr 28, 2021
1 parent fa800ab commit fcfa28d
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 13 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/

package play.it.http.parsingdeferred;

import play.libs.typedmap.TypedKey;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/

package play.it.http.parsingdeferred;

import play.mvc.Action;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
/*
* Copyright (C) Lightbend Inc. <https://www.lightbend.com>
*/

package play.it.http.parsingdeferred

import java.util.concurrent.CompletableFuture
Expand Down
24 changes: 11 additions & 13 deletions core/play/src/main/scala/play/api/mvc/Action.scala
Original file line number Diff line number Diff line change
Expand Up @@ -226,19 +226,17 @@ object BodyParser {
): Future[Result] = {
request.attrs
.get(RequestAttrKey.DeferredBodyParserInvoker)
.map(
invokeAction => {
logger.trace("Body parsing was deferred, eventually parsing now for request: " + request)
invokeAction(
// First runs the parser, then invokes the given "next" action
// (We remove the request attribute in case calling this method multiple times it won't parse again)
Future(
runParserThenInvokeAction(parser, request.removeAttr(RequestAttrKey.DeferredBodyParserInvoker), next)
),
false
)
}
)
.map(invokeAction => {
logger.trace("Body parsing was deferred, eventually parsing now for request: " + request)
invokeAction(
// First runs the parser, then invokes the given "next" action
// (We remove the request attribute in case calling this method multiple times it won't parse again)
Future(
runParserThenInvokeAction(parser, request.removeAttr(RequestAttrKey.DeferredBodyParserInvoker), next)
),
false
)
})
.getOrElse({
logger.trace("Not parsing body, was parsed before already for request: " + request)
next(request)
Expand Down

0 comments on commit fcfa28d

Please sign in to comment.