Skip to content

Commit eaa735d

Browse files
committed
Fixed bug where the request was not set on the transformer prior to dispatching request. Fixes #101.
Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
1 parent bbe8149 commit eaa735d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

src/Routing/Router.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,8 @@ public function dispatch(Request $request)
157157

158158
$this->container->instance('Illuminate\Http\Request', $request);
159159

160+
ApiResponse::getTransformer()->setRequest($request);
161+
160162
try {
161163
$response = parent::dispatch($request);
162164
} catch (Exception $exception) {
@@ -283,10 +285,6 @@ protected function prepareResponse($request, $response)
283285

284286
if ($response instanceof IlluminateResponse && $this->requestTargettingApi($request)) {
285287
$response = ApiResponse::makeFromExisting($response);
286-
}
287-
288-
if ($response instanceof ApiResponse) {
289-
ApiResponse::getTransformer()->setRequest($request);
290288
}
291289

292290
if ($response->isSuccessful() && $this->getConditionalRequest()) {

0 commit comments

Comments
 (0)