mirror of
https://git.deluge-torrent.org/deluge
synced 2025-04-20 03:24:54 +00:00
[WebUI|Py3] Refactor content_type check
Simplify getting content_type from request to prevent str/bytes mixup.
This commit is contained in:
parent
86de5657ff
commit
6f06cd5ebc
1 changed files with 3 additions and 4 deletions
|
@ -194,10 +194,9 @@ class JSON(resource.Resource, component.Component):
|
|||
Handler to take the json data as a string and pass it on to the
|
||||
_handle_request method for further processing.
|
||||
"""
|
||||
if request.getHeader(b'content-type') != b'application/json':
|
||||
message = 'Invalid JSON request content-type: %s' % request.getHeader(
|
||||
'content-type'
|
||||
)
|
||||
content_type = request.getHeader(b'content-type').decode()
|
||||
if content_type != 'application/json':
|
||||
message = 'Invalid JSON request content-type: %s' % content_type
|
||||
raise JSONException(message)
|
||||
|
||||
log.debug('json-request: %s', request.json)
|
||||
|
|
Loading…
Add table
Reference in a new issue