Skip to content

Commit

Permalink
Merge pull request #795 from MasoniteFramework/fix/794
Browse files Browse the repository at this point in the history
Fix/794 - Fix issue with JSON responses
  • Loading branch information
josephmancuso committed Jun 24, 2019
2 parents ed29afe + a4439e0 commit 762abda
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions masonite/request.py
Original file line number Diff line number Diff line change
Expand Up @@ -396,6 +396,9 @@ def _set_header(self, key, value, http_prefix):
self.environ[key] = str(value)
self._headers.update({key: str(value)})

def has_raw_header(self, key):
return key in self._headers

def get_headers(self):
"""Return all current headers to be set.
Expand Down
2 changes: 1 addition & 1 deletion masonite/response.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def make_headers(self, content_type="text/html; charset=utf-8"):
self.request.header('Content-Length', str(len(self.to_bytes())))

# If the user did not change it directly
if not self.request.header('Content-Type'):
if not self.request.has_raw_header('Content-Type'):
self.request.header('Content-Type', content_type)

def data(self):
Expand Down

0 comments on commit 762abda

Please sign in to comment.