Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions src/msgraph_core/requests/batch_request_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,19 +258,16 @@ def serialize(self, writer: SerializationWriter) -> None:
writer.write_str_value('method', self.method)
writer.write_str_value('url', self.url)
writer.write_collection_of_primitive_values('depends_on', self._depends_on)
writer.write_collection_of_object_values(
'headers',
self._headers # type: ignore # need method to serialize dicts
writer.write_additional_data_value(
{'headers': self._headers} # need proper method to serialize dicts
Comment thread
baywet marked this conversation as resolved.
Outdated
)
if self._body:
json_object = json.loads(self._body)
is_json_string = json_object and isinstance(json_object, dict)
# /$batch API expects JSON object or base 64 encoded value for the body
if is_json_string:
writer.write_collection_of_object_values( # type: ignore
# need method to serialize dicts
'body',
json_object
writer.write_additional_data_value(
{'body': json_object} # need proper method to serialize dicts
Comment thread
baywet marked this conversation as resolved.
Outdated
)
else:
writer.write_str_value('body', base64.b64encode(self._body).decode('utf-8'))