fix: Remove content-type header from IDMS GET requests by peter-volkov · Pull Request #1489 · googleapis/google-auth-library-python
peter-volkov
changed the title
Remove content-type header from IDMS GET requests
fix: Remove content-type header from IDMS GET requests
parthea
added
the
do not merge
label
Mar 5, 2024chalmerlowe added a commit that referenced this pull request
Jan 14, 2026When performing a IMDS request, the code incorrectly adds a content-type header to the request: `content-type: application/json` to AWS metadata (IMDS) GET requests.` Some services at AWS (such as AWS SageMaker Jupyter notebook) have a stricter than normal metadata server (IMDS, both v1 and v2) when it comes to handling incoming http requests. This PR removes the default content-header and replaces it with `None`. NOTE: initializing headers to `None` (instead of an empty `dict`) when no session token is present matches the existing behavior in `_get_metadata_role_name` and allows the transport adapter to handle default headers cleanly. This PR updates existing unit tests (`tests/test_aws.py`) to match the new behavior. NOTE: closing PR #1489 due to inactivity as we make the push to migrate this library to the `google-cloud-python` monorepo For more information about the genesis of this, see the following issue: https://issuetracker.google.com/issues/328089077
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters