You've already forked httpie-cli
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:
committed by
GitHub
parent
39314887c4
commit
0ff0874fa3
@@ -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()
|
||||
]
|
||||
|
||||
|
Reference in New Issue
Block a user