diff --git a/src/Mpociot/ApiDoc/Generators/LaravelGenerator.php b/src/Mpociot/ApiDoc/Generators/LaravelGenerator.php index b024e97e..14c1e137 100644 --- a/src/Mpociot/ApiDoc/Generators/LaravelGenerator.php +++ b/src/Mpociot/ApiDoc/Generators/LaravelGenerator.php @@ -27,20 +27,20 @@ protected function getUri($route) */ public function processRoute($route, $bindings = [], $withResponse = true) { - $response = ''; - - if ($withResponse) { - $response = $this->getRouteResponse($route, $bindings); - } + $content = ''; $routeAction = $route->getAction(); $routeGroup = $this->getRouteGroup($routeAction['uses']); $routeDescription = $this->getRouteDescription($routeAction['uses']); - if ($response->headers->get('Content-Type') === 'application/json') { - $content = json_encode(json_decode($response->getContent()), JSON_PRETTY_PRINT); - } else { - $content = $response->getContent(); + + if ($withResponse) { + $response = $this->getRouteResponse($route, $bindings); + if ($response->headers->get('Content-Type') === 'application/json') { + $content = json_encode(json_decode($response->getContent()), JSON_PRETTY_PRINT); + } else { + $content = $response->getContent(); + } } return $this->getParameters([