Skip to content

Commit

Permalink
Merge pull request #15 from Wachizungu/fix-get-event-from-message-exc…
Browse files Browse the repository at this point in the history
…eption

fix: raise 'empty message body exception' for get_event_from_message …
  • Loading branch information
righel authored Nov 22, 2024
2 parents a47196f + facf5ed commit 50fd332
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/mispguard.py
Original file line number Diff line number Diff line change
Expand Up @@ -905,7 +905,7 @@ def is_allowed_endpoint(self, method: str, path: str) -> bool:

def get_event_from_message(self, message: http.Message) -> dict:
if message.content is None:
return Exception("empty message body")
raise Exception("empty message body")
try:
event = message.json()
if "Event" not in event:
Expand All @@ -916,15 +916,15 @@ def get_event_from_message(self, message: http.Message) -> dict:

def get_shadow_attributes_from_message(self, message: http.Message) -> dict:
if message.content is None:
return Exception("empty message body")
raise Exception("empty message body")
try:
return message.json()
except json.decoder.JSONDecodeError:
raise Exception("invalid JSON body")

def get_galaxy_cluster_from_message(self, message: http.Message) -> dict:
if message.content is None:
return Exception("empty message body")
raise Exception("empty message body")
try:
return message.json()
except json.decoder.JSONDecodeError:
Expand Down

0 comments on commit 50fd332

Please sign in to comment.