Skip to content

Commit

Permalink
Use body instead of body_bytes in HTTPResponse.
Browse files Browse the repository at this point in the history
See:

* sanic-org/sanic#1739 - Deprecated in 20.6.1.
* sanic-org/sanic#1981 - Removed in 20.12.1.
  • Loading branch information
sangaline committed Nov 17, 2022
1 parent ebcf393 commit 9e70f77
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sanic_transmute/handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ async def handler(request, *args, **kwargs):
status=response["code"],
content_type=response["content-type"],
headers=response["headers"],
body_bytes=response["body"],
body=response["body"],
)
handler.transmute_func = transmute_func
return handler
Expand Down
4 changes: 2 additions & 2 deletions sanic_transmute/swagger.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def add_swagger_api_route(app, target_route, swagger_json_route):
).encode("utf-8")

async def swagger_ui(request):
return HTTPResponse(body_bytes=swagger_body, content_type="text/html")
return HTTPResponse(body=swagger_body, content_type="text/html")

bp = Blueprint('swagger')
bp.static(STATIC_ROOT, static_root)
Expand All @@ -65,7 +65,7 @@ def create_swagger_json_handler(app, **kwargs):

async def swagger(request):
return HTTPResponse(
body_bytes=encoded_spec,
body=encoded_spec,
headers={
"Access-Control-Allow-Origin": "*"
},
Expand Down

0 comments on commit 9e70f77

Please sign in to comment.