1
0
mirror of https://github.com/httpie/cli.git synced 2025-08-10 22:42:05 +02:00

Modernize the code base with f-strings (#1068)

This commit is contained in:
Mickaël Schoentgen
2021-05-25 20:49:07 +02:00
committed by GitHub
parent 39314887c4
commit 0ff0874fa3
9 changed files with 43 additions and 63 deletions

View File

@@ -102,7 +102,7 @@ class HTTPRequest(HTTPMessage):
request_line = '{method} {path}{query} HTTP/1.1'.format(
method=self._orig.method,
path=url.path or '/',
query='?' + url.query if url.query else ''
query=f'?{url.query}' if url.query else ''
)
headers = dict(self._orig.headers)
@@ -110,10 +110,7 @@ class HTTPRequest(HTTPMessage):
headers['Host'] = url.netloc.split('@')[-1]
headers = [
'%s: %s' % (
name,
value if isinstance(value, str) else value.decode('utf8')
)
f'{name}: {value if isinstance(value, str) else value.decode("utf-8")}'
for name, value in headers.items()
]