Skip to content
This repository was archived by the owner on Mar 6, 2026. It is now read-only.
2 changes: 1 addition & 1 deletion google/auth/iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def _make_signing_request(self, message):

method = "POST"
url = _SIGN_BLOB_URI.format(self._service_account_email)
headers = {}
headers = {"Content-Type": "application/json"}
body = json.dumps(
{"bytesToSign": base64.b64encode(message).decode("utf-8")}
).encode("utf-8")
Expand Down
2 changes: 2 additions & 0 deletions tests/test_iam.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,8 @@ def test_sign_bytes(self):
returned_signature = signer.sign("123")

assert returned_signature == signature
kwargs = request.call_args.kwargs
assert kwargs["headers"]["Content-Type"] == "application/json"

def test_sign_bytes_failure(self):
request = make_request(http_client.UNAUTHORIZED)
Expand Down