diff --git a/src/masonite/authorization/Gate.py b/src/masonite/authorization/Gate.py index c79b433c5..1c7aa7fb2 100644 --- a/src/masonite/authorization/Gate.py +++ b/src/masonite/authorization/Gate.py @@ -101,6 +101,7 @@ def inspect(self, permission, *args): if boolean_result: return AuthorizationResponse.allow() else: + self.application.make("response").status(403) return AuthorizationResponse.deny() def check(self, permission, *args): diff --git a/src/masonite/dumps/Dumper.py b/src/masonite/dumps/Dumper.py index 188a7b302..33ff67d78 100644 --- a/src/masonite/dumps/Dumper.py +++ b/src/masonite/dumps/Dumper.py @@ -16,11 +16,13 @@ def clear(self): def dd(self, *objects): """Dump all provided args and die, raising a DumpException.""" + self.app.make('response').status(200) self._dump(*objects) raise DumpException() def dump(self, *objects): """Dump all provided args and continue code execution. This does not raise a DumpException.""" + self.app.make('response').status(200) dumps = self._dump(*objects) # output dumps in console for dump in dumps: diff --git a/src/masonite/exceptions/handlers/ModelNotFoundHandler.py b/src/masonite/exceptions/handlers/ModelNotFoundHandler.py index 81559ef19..7d6880eb2 100644 --- a/src/masonite/exceptions/handlers/ModelNotFoundHandler.py +++ b/src/masonite/exceptions/handlers/ModelNotFoundHandler.py @@ -9,4 +9,5 @@ def handle(self, exception): masonite_exception = ModelNotFoundException( "No record found with the given primary key" ) + self.application.make("response").status(404) self.application.make("exception_handler").handle(masonite_exception) diff --git a/src/masonite/providers/RouteProvider.py b/src/masonite/providers/RouteProvider.py index 81e1e662e..b3e4ce308 100644 --- a/src/masonite/providers/RouteProvider.py +++ b/src/masonite/providers/RouteProvider.py @@ -56,6 +56,8 @@ def boot(self): else: response.view(data) except Exception as e: + if not response.get_status_code(): + response.status(500) exception = e self.application.make("middleware").run_route_middleware(