fix(sdk/client): reserve the host protocal (http or https) so that http host can work. Fixes #4277 (#4285)

This commit is contained in:
Renmin 2020-07-30 11:38:30 +08:00 committed by GitHub
parent c7300c343c
commit cc78bd1a4f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 4 deletions

View File

@ -147,11 +147,8 @@ class Client(object):
host = host or ''
# Preprocess the host endpoint to prevent some common user mistakes.
# This should only be done for non-IAP cases (when client_id is None). IAP requires preserving the protocol.
if not client_id:
# Per feedback in proxy env, http or https is still required
if not proxy:
host = re.sub(r'^(http|https)://', '', host)
# always preserving the protocol (http://localhost requires it)
host = host.rstrip('/')
if host: