From e3aa7a0b23bc4bfd5170753f74bdeac219902d1a Mon Sep 17 00:00:00 2001 From: Vadym Matsishevskyi <25311427+vam-google@users.noreply.github.com> Date: Wed, 3 Nov 2021 13:01:16 -0700 Subject: [PATCH] fix: fix missing http schema (http/https) for REST clients (#1063) * fix: fix missing http schema (http/https) for REST clients * update integration tests to match templates changes --- .../%sub/services/%service/transports/rest.py.j2 | 3 ++- gapic/templates/setup.py.j2 | 2 +- tests/integration/goldens/asset/setup.py | 2 +- tests/integration/goldens/credentials/setup.py | 2 +- tests/integration/goldens/logging/setup.py | 2 +- tests/integration/goldens/redis/setup.py | 2 +- 6 files changed, 7 insertions(+), 6 deletions(-) diff --git a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 index 7d678a8f6c..dbc7536628 100644 --- a/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 +++ b/gapic/templates/%namespace/%name_%version/%sub/services/%service/transports/rest.py.j2 @@ -233,7 +233,8 @@ class {{service.name}}RestTransport({{service.name}}Transport): headers = dict(metadata) headers['Content-Type'] = 'application/json' response=getattr(self._session, method)( - uri, + # Replace with proper schema configuration (http/https) logic + "https://{host}{uri}".format(host=self._host, uri=uri), timeout=timeout, headers=headers, params=rest_helpers.flatten_query_params(query_params), diff --git a/gapic/templates/setup.py.j2 b/gapic/templates/setup.py.j2 index 7351e42968..22eef15fd5 100644 --- a/gapic/templates/setup.py.j2 +++ b/gapic/templates/setup.py.j2 @@ -34,7 +34,7 @@ setuptools.setup( 'google-api-core[grpc] >= 1.28.0, < 3.0.0dev', {% endif %} 'libcst >= 0.2.5', - 'proto-plus >= 1.19.4', + 'proto-plus >= 1.19.7', {% if api.requires_package(('google', 'iam', 'v1')) or opts.add_iam_methods %} 'grpc-google-iam-v1 >= 0.12.3, < 0.13dev', {% endif %} diff --git a/tests/integration/goldens/asset/setup.py b/tests/integration/goldens/asset/setup.py index 8994eddd9d..82da50b971 100644 --- a/tests/integration/goldens/asset/setup.py +++ b/tests/integration/goldens/asset/setup.py @@ -36,7 +36,7 @@ install_requires=( 'google-api-core[grpc] >= 1.28.0, < 3.0.0dev', 'libcst >= 0.2.5', - 'proto-plus >= 1.19.4', + 'proto-plus >= 1.19.7', 'grpc-google-iam-v1 >= 0.12.3, < 0.13dev', ), python_requires='>=3.6', diff --git a/tests/integration/goldens/credentials/setup.py b/tests/integration/goldens/credentials/setup.py index 2690e8742a..1b831af236 100644 --- a/tests/integration/goldens/credentials/setup.py +++ b/tests/integration/goldens/credentials/setup.py @@ -36,7 +36,7 @@ install_requires=( 'google-api-core[grpc] >= 1.28.0, < 3.0.0dev', 'libcst >= 0.2.5', - 'proto-plus >= 1.19.4', + 'proto-plus >= 1.19.7', ), python_requires='>=3.6', classifiers=[ diff --git a/tests/integration/goldens/logging/setup.py b/tests/integration/goldens/logging/setup.py index f3fc9586e5..5d505b2fa2 100644 --- a/tests/integration/goldens/logging/setup.py +++ b/tests/integration/goldens/logging/setup.py @@ -36,7 +36,7 @@ install_requires=( 'google-api-core[grpc] >= 1.28.0, < 3.0.0dev', 'libcst >= 0.2.5', - 'proto-plus >= 1.19.4', + 'proto-plus >= 1.19.7', ), python_requires='>=3.6', classifiers=[ diff --git a/tests/integration/goldens/redis/setup.py b/tests/integration/goldens/redis/setup.py index 1972f2de40..46d59d5f34 100644 --- a/tests/integration/goldens/redis/setup.py +++ b/tests/integration/goldens/redis/setup.py @@ -36,7 +36,7 @@ install_requires=( 'google-api-core[grpc] >= 1.28.0, < 3.0.0dev', 'libcst >= 0.2.5', - 'proto-plus >= 1.19.4', + 'proto-plus >= 1.19.7', ), python_requires='>=3.6', classifiers=[