Skip to content

Commit

Permalink
Refactor Dumper to set response status to 200 before dumping objects
Browse files Browse the repository at this point in the history
  • Loading branch information
josephmancuso committed Oct 23, 2024
1 parent c97e646 commit f30e5b5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/masonite/dumps/Dumper.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
1 change: 1 addition & 0 deletions src/masonite/exceptions/handlers/ModelNotFoundHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit f30e5b5

Please sign in to comment.