aboutsummaryrefslogtreecommitdiff
path: root/src/utils/http.py
diff options
context:
space:
mode:
authorGravatar jesopo2019-10-05 22:56:56 +0100
committerGravatar jesopo2019-10-05 22:56:56 +0100
commit9ab817ca586e549afa648931e5171d9704d3e356 (patch)
treebf659c3b015cd438402daeac9af14b1cd5469b83 /src/utils/http.py
parentbetter help/usage for quote.py commands (diff)
signature
parse out content_type in Response ctor
Diffstat (limited to 'src/utils/http.py')
-rw-r--r--src/utils/http.py8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/utils/http.py b/src/utils/http.py
index 6c48058c..4a9db07e 100644
--- a/src/utils/http.py
+++ b/src/utils/http.py
@@ -121,11 +121,11 @@ class Request(object):
class Response(object):
def __init__(self, code: int, data: typing.Any,
- content_type: str, headers: typing.Dict[str, str], encoding: str):
+ headers: typing.Dict[str, str], encoding: str):
self.code = code
self.data = data
- self.content_type = content_type
self.headers = headers
+ self.content_type = headers.get("Content-Type", "").split(";", 1)[0]
self.encoding = encoding
def _meta_content(s: str) -> typing.Dict[str, str]:
@@ -177,10 +177,8 @@ def _request(request_obj: Request) -> Response:
raise ValueError("Response too large")
headers = utils.CaseInsensitiveDict(dict(response.headers))
- content_type = headers.get("Content-Type", "").split(";", 1)[0]
our_response = Response(response.status_code, response_content,
- content_type=content_type, headers=headers,
- encoding=response.encoding)
+ headers=headers, encoding=response.encoding)
return our_response
try: