Skip to content

Commit

Permalink
Allow render to access status code (#938)
Browse files Browse the repository at this point in the history
* Allow render to access status code

Minor change the sequence for init status and body, so render can access status code

* Move render before ini_headers
  • Loading branch information
walt-w committed Jun 1, 2020
1 parent d6d0f83 commit 519f575
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion starlette/responses.py
Expand Up @@ -42,11 +42,11 @@ def __init__(
media_type: str = None,
background: BackgroundTask = None,
) -> None:
self.body = self.render(content)
self.status_code = status_code
if media_type is not None:
self.media_type = media_type
self.background = background
self.body = self.render(content)
self.init_headers(headers)

def render(self, content: typing.Any) -> bytes:
Expand Down

0 comments on commit 519f575

Please sign in to comment.