Skip to content

Commit 5d9371c

Browse files
committed
Fixed missing body parameters in response calls - add request parameters to Symfony request content
1 parent e693d74 commit 5d9371c

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/Extracting/Strategies/Responses/ResponseCalls.php

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,15 @@ protected function prepareRequest(Route $route, array $rulesToApply, array $urlP
9292
$routeMethods = $this->getMethods($route);
9393
$method = array_shift($routeMethods);
9494
$cookies = isset($rulesToApply['cookies']) ? $rulesToApply['cookies'] : [];
95-
$request = Request::create($uri, $method, [], $cookies, [], $this->transformHeadersToServerVars($headers));
95+
96+
// Note that we initialise the request with the bodyPatams here
97+
// and later still add them to the ParameterBag (`addBodyParameters`)
98+
// The first is so the body params get added to the request content
99+
// (where Laravel reads body from)
100+
// The second is so they get added to the request bag
101+
// (where Symfony usually reads from and Laravel sometimes does)
102+
// Adding to both ensures consistency
103+
$request = Request::create($uri, $method, [], $cookies, [], $this->transformHeadersToServerVars($headers), json_encode($bodyParams));
96104
// Doing it again to catch any ones we didn't transform properly.
97105
$request = $this->addHeaders($request, $route, $headers);
98106

0 commit comments

Comments
 (0)