From 490eeaa650a4dbffd411413e183b96ce806939dd Mon Sep 17 00:00:00 2001 From: Jakub Roztocil Date: Tue, 3 Dec 2019 19:09:09 +0100 Subject: [PATCH] Cleanup --- httpie/cli/constants.py | 2 +- httpie/client.py | 8 ++++---- httpie/sessions.py | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/httpie/cli/constants.py b/httpie/cli/constants.py index 2b22fbe0..ba34dcc9 100644 --- a/httpie/cli/constants.py +++ b/httpie/cli/constants.py @@ -6,7 +6,7 @@ import ssl # TODO: Use MultiDict for headers once added to `requests`. -# https://github.com/jakubroztocil/httpie/issues/130 +# # ALPHA *( ALPHA / DIGIT / "+" / "-" / "." ) diff --git a/httpie/client.py b/httpie/client.py index 34aa2f10..431bee4f 100644 --- a/httpie/client.py +++ b/httpie/client.py @@ -183,13 +183,13 @@ def finalize_headers(headers: RequestHeadersDict) -> RequestHeadersDict: final_headers = RequestHeadersDict() for name, value in headers.items(): if value is not None: - # >leading or trailing LWS MAY be removed without - # >changing the semantics of the field value" - # -https://www.w3.org/Protocols/rfc2616/rfc2616-sec4.html + # “leading or trailing LWS MAY be removed without + # changing the semantics of the field value” + # # Also, requests raises `InvalidHeader` for leading spaces. value = value.strip() if isinstance(value, str): - # See: https://github.com/jakubroztocil/httpie/issues/212 + # See value = value.encode('utf8') final_headers[name] = value return final_headers diff --git a/httpie/sessions.py b/httpie/sessions.py index 7d75583e..7ed7331e 100644 --- a/httpie/sessions.py +++ b/httpie/sessions.py @@ -21,7 +21,7 @@ DEFAULT_SESSIONS_DIR = DEFAULT_CONFIG_DIR / SESSIONS_DIR_NAME VALID_SESSION_NAME_PATTERN = re.compile('^[a-zA-Z0-9_.-]+$') # Request headers starting with these prefixes won't be stored in sessions. # They are specific to each request. -# https://en.wikipedia.org/wiki/List_of_HTTP_header_fields#Requests +# SESSION_IGNORED_HEADER_PREFIXES = ['Content-', 'If-'] @@ -102,7 +102,7 @@ class Session(BaseConfigDict): @cookies.setter def cookies(self, jar: RequestsCookieJar): - # https://docs.python.org/2/library/cookielib.html#cookie-objects + # stored_attrs = ['value', 'path', 'secure', 'expires'] self['cookies'] = {} for cookie in jar: