diff --git a/CHANGELOG.md b/CHANGELOG.md index eff4202b8..c43ab2b1c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,13 @@ [1]: https://pypi.org/project/google-auth/#history +## [2.40.1](https://github.com/googleapis/google-auth-library-python/compare/v2.40.0...v2.40.1) (2025-05-06) + + +### Bug Fixes + +* Disable logging response body for async logs ([#1756](https://github.com/googleapis/google-auth-library-python/issues/1756)) ([2f0ddfe](https://github.com/googleapis/google-auth-library-python/commit/2f0ddfeb9f6c726c68beebd7eefd32c86f7f0963)) + ## [2.40.0](https://github.com/googleapis/google-auth-library-python/compare/v2.39.0...v2.40.0) (2025-04-29) diff --git a/google/auth/aio/_helpers.py b/google/auth/aio/_helpers.py index fd7d37a2f..1d5a4618c 100644 --- a/google/auth/aio/_helpers.py +++ b/google/auth/aio/_helpers.py @@ -53,5 +53,10 @@ async def response_log_async(logger: logging.Logger, response: Any) -> None: response: The HTTP response object to log. """ if _helpers.is_logging_enabled(logger): - json_response = await _parse_response_async(response) + # TODO(https://github.com/googleapis/google-auth-library-python/issues/1755): + # Parsing the response for async streaming logging results in + # the stream to be empty downstream. For now, we will not be logging + # the response for async responses until we investigate further. + # json_response = await _parse_response_async(response) + json_response = None _helpers._response_log_base(logger, json_response) diff --git a/google/auth/version.py b/google/auth/version.py index d1363c1ef..ee0bb1260 100644 --- a/google/auth/version.py +++ b/google/auth/version.py @@ -12,4 +12,4 @@ # See the License for the specific language governing permissions and # limitations under the License. -__version__ = "2.40.0" +__version__ = "2.40.1" diff --git a/system_tests/secrets.tar.enc b/system_tests/secrets.tar.enc index fe6fb3aa0..8fa36e70b 100644 Binary files a/system_tests/secrets.tar.enc and b/system_tests/secrets.tar.enc differ diff --git a/tests/aio/test__helpers.py b/tests/aio/test__helpers.py index 7642431ca..829dc97ff 100644 --- a/tests/aio/test__helpers.py +++ b/tests/aio/test__helpers.py @@ -65,17 +65,13 @@ async def test_response_log_debug_disabled(logger, caplog, base_logger): @pytest.mark.asyncio async def test_response_log_debug_enabled_response_json(logger, caplog, base_logger): - class MockResponse: - async def json(self): - return {"key1": "value1", "key2": "value2", "key3": "value3"} - - response = MockResponse() + response = None caplog.set_level(logging.DEBUG, logger=_MOCK_CHILD_LOGGER_NAME) await _helpers.response_log_async(logger, response) assert len(caplog.records) == 1 record = caplog.records[0] assert record.message == "Response received..." - assert record.httpResponse == {"key1": "value1", "key2": "value2", "key3": "value3"} + assert record.httpResponse == "" @pytest.mark.asyncio