Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Microsoft Graph API] requests error out when the results are not in JSON format #36567

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,11 @@ def generic_request(
json_data=request_body,
resp_type='resp',
)
return res.json() if res.content else None
try:
return res.json() if res.content else None
except json.decoder.JSONDecodeError as e:
demisto.debug(f"Failed to decode JSON: {str(e)}. Response content: {res.content}")
return res.content


def start_auth(client: MsGraphClient) -> CommandResults: # pragma: no cover
Expand Down
6 changes: 6 additions & 0 deletions Packs/MicrosoftGraphAPI/ReleaseNotes/1_1_50.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

#### Integrations

##### Microsoft Graph API

Fixed an issue where empty, invalid, or non-JSON responses could cause errors.
2 changes: 1 addition & 1 deletion Packs/MicrosoftGraphAPI/pack_metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "Microsoft Graph API",
"description": "Use the Microsoft Graph API integration to interact with Microsoft APIs that do not have dedicated integrations in Cortex XSOAR, for example, Mail Single-User, etc.",
"support": "xsoar",
"currentVersion": "1.1.49",
"currentVersion": "1.1.50",
"author": "Cortex XSOAR",
"url": "https://www.paloaltonetworks.com/cortex",
"email": "",
Expand Down
Loading