Skip to content

Commit

Permalink
Properly set the JSON payload of FormRequests instead of re-building it
Browse files Browse the repository at this point in the history
  • Loading branch information
themsaid committed Feb 3, 2017
1 parent 0ba0887 commit 9a1c5f3
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ protected function initializeRequest(FormRequest $form, Request $current)
$current->cookies->all(), $files, $current->server->all(), $current->getContent()
);

$form->setJson($current->json());

if ($session = $current->getSession()) {
$form->setLaravelSession($session);
}
Expand Down
11 changes: 11 additions & 0 deletions src/Illuminate/Http/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -302,6 +302,17 @@ public function json($key = null, $default = null)
return data_get($this->json->all(), $key, $default);
}

/**
* Set the JSON payload for the request.
*
* @param array $json
* @return void
*/
public function setJson($json)
{
$this->json = $json;
}

/**
* Get the input source for the request.
*
Expand Down

0 comments on commit 9a1c5f3

Please sign in to comment.