Skip to content

Commit

Permalink
Add request attribute indicating whether the body has been parsed
Browse files Browse the repository at this point in the history
  • Loading branch information
lainosantos authored Nov 30, 2022
1 parent 3be8bac commit 2b397a2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/HttpWorker.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,8 @@ private function hydrateRequest(Request $request, array $context): void
$request->cookies = (array)($context['cookies'] ?? []);
$request->uploads = (array)($context['uploads'] ?? []);
$request->parsed = (bool)$context['parsed'];

$request->attributes[Request::PARSED_BODY_ATTRIBUTE_NAME] = $request->parsed;
}

/**
Expand Down
2 changes: 2 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
#[Immutable]
final class Request
{
public const PARSED_BODY_ATTRIBUTE_NAME = 'rr_parsed_body';

/**
* @var string
*/
Expand Down

0 comments on commit 2b397a2

Please sign in to comment.