mirror of
https://github.com/httpie/cli.git
synced 2026-06-20 11:32:56 +02:00
Added support and tests for unicode support in sessions.
This commit is contained in:
1 parent
e8a1c051f9
commit
a3352af1d4
4 files changed
+38
-13
No files matched your search
@@ -19,11 +19,16 @@ class HTTPBasicAuth(requests.auth.HTTPBasicAuth):
|
||||
See https://github.com/jkbr/httpie/issues/212
|
||||
|
||||
"""
|
||||
credentials = u'%s:%s' % (self.username, self.password)
|
||||
token = b64encode(credentials.encode('utf8')).strip().decode('latin1')
|
||||
r.headers['Authorization'] = 'Basic %s' % token
|
||||
r.headers['Authorization'] = type(self).make_header(
|
||||
self.username, self.password).encode('latin1')
|
||||
return r
|
||||
|
||||
@staticmethod
|
||||
def make_header(username, password):
|
||||
credentials = u'%s:%s' % (username, password)
|
||||
token = b64encode(credentials.encode('utf8')).strip().decode('latin1')
|
||||
return 'Basic %s' % token
|
||||
|
||||
|
||||
class BasicAuthPlugin(BuiltinAuthPlugin):
|
||||
|
||||
|
||||
Reference in new issue
Block a user