Skip to content

Commit ea3a24a

Browse files
committed
fix BatchRequestItem now properly serializes the header and body fields
1 parent f6bb0e7 commit ea3a24a

File tree

1 file changed

+4
-7
lines changed

1 file changed

+4
-7
lines changed

src/msgraph_core/requests/batch_request_item.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -258,19 +258,16 @@ def serialize(self, writer: SerializationWriter) -> None:
258258
writer.write_str_value('method', self.method)
259259
writer.write_str_value('url', self.url)
260260
writer.write_collection_of_primitive_values('depends_on', self._depends_on)
261-
writer.write_collection_of_object_values(
262-
'headers',
263-
self._headers # type: ignore # need method to serialize dicts
261+
writer.write_additional_data_value(
262+
{'headers': self._headers} # need proper method to serialize dicts
264263
)
265264
if self._body:
266265
json_object = json.loads(self._body)
267266
is_json_string = json_object and isinstance(json_object, dict)
268267
# /$batch API expects JSON object or base 64 encoded value for the body
269268
if is_json_string:
270-
writer.write_collection_of_object_values( # type: ignore
271-
# need method to serialize dicts
272-
'body',
273-
json_object
269+
writer.write_additional_data_value(
270+
{'body': json_object} # need proper method to serialize dicts
274271
)
275272
else:
276273
writer.write_str_value('body', base64.b64encode(self._body).decode('utf-8'))

0 commit comments

Comments
 (0)