Skip to content

Commit d5b90db

Browse files
committed
Fix body_str variable usage in schema registry clients
The cherry-picked commit 46f24ce changed body to body_str (JSON string) but the variable was not updated when passing to send_http_request(). This caused TypeError: Unexpected type for 'content', <class 'dict'>. Fixed by using body_str instead of body when calling send_http_request.
1 parent 772c1bd commit d5b90db

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/confluent_kafka/schema_registry/_async/schema_registry_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ async def send_request(
437437
" application/vnd.schemaregistry+json,"
438438
" application/json"}
439439

440+
body_str = None
440441
if body is not None:
441442
body_str = json.dumps(body)
442443
headers = {'Content-Length': str(len(body_str)),
@@ -450,7 +451,7 @@ async def send_request(
450451
for i, base_url in enumerate(self.base_urls):
451452
try:
452453
response = await self.send_http_request(
453-
base_url, url, method, headers, body, query)
454+
base_url, url, method, headers, body_str, query)
454455

455456
if is_success(response.status_code):
456457
return response.json()

src/confluent_kafka/schema_registry/_sync/schema_registry_client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -437,6 +437,7 @@ def send_request(
437437
" application/vnd.schemaregistry+json,"
438438
" application/json"}
439439

440+
body_str = None
440441
if body is not None:
441442
body_str = json.dumps(body)
442443
headers = {'Content-Length': str(len(body_str)),
@@ -450,7 +451,7 @@ def send_request(
450451
for i, base_url in enumerate(self.base_urls):
451452
try:
452453
response = self.send_http_request(
453-
base_url, url, method, headers, body, query)
454+
base_url, url, method, headers, body_str, query)
454455

455456
if is_success(response.status_code):
456457
return response.json()

0 commit comments

Comments
 (0)