diff --git a/src/Decorators/ControllerDecorator.php b/src/Decorators/ControllerDecorator.php index 3fc4eaf..54f8d70 100644 --- a/src/Decorators/ControllerDecorator.php +++ b/src/Decorators/ControllerDecorator.php @@ -70,9 +70,9 @@ public function __invoke(string $method) $response = $this->run($method); - if ($this->hasMethod('jsonResponse') && $request->expectsJson()) { + if ($this->hasMethod('jsonResponse') && ($request->expectsJson() || $request->isJson())) { $response = $this->callMethod('jsonResponse', [$response, $request]); - } elseif ($this->hasMethod('htmlResponse') && ! $request->expectsJson()) { + } elseif ($this->hasMethod('htmlResponse') && ! ($request->expectsJson() || $request->isJson())) { $response = $this->callMethod('htmlResponse', [$response, $request]); }