From 27b6fe777b4913d58923c5fdad51dd8974e86e39 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Wed, 28 Feb 2024 12:00:13 +0100 Subject: [PATCH] rest: Set OAuth Content-Type header explicitly (#478) --- pyiceberg/catalog/rest.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pyiceberg/catalog/rest.py b/pyiceberg/catalog/rest.py index ab3d22efba..6b952ef06d 100644 --- a/pyiceberg/catalog/rest.py +++ b/pyiceberg/catalog/rest.py @@ -290,8 +290,9 @@ def _fetch_access_token(self, session: Session, credential: str) -> str: else: client_id, client_secret = None, credential data = {GRANT_TYPE: CLIENT_CREDENTIALS, CLIENT_ID: client_id, CLIENT_SECRET: client_secret, SCOPE: CATALOG_SCOPE} - # Uses application/x-www-form-urlencoded by default - response = session.post(url=self.auth_url, data=data) + response = session.post( + url=self.auth_url, data=data, headers={**session.headers, "Content-type": "application/x-www-form-urlencoded"} + ) try: response.raise_for_status() except HTTPError as exc: