Skip to content

Commit 9fca7e1

Browse files
cpimentxrmx
authored andcommitted
Check if body exists before trying to convert it to JSON
1 parent e4dff95 commit 9fca7e1

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

  • elasticapm/instrumentation/packages

elasticapm/instrumentation/packages/azure.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -300,9 +300,12 @@ def handle_azuretable(request, hostname, path, query_params, service, service_ty
300300
account_name = hostname.split(".")[0]
301301
method = request.method
302302
body = request.body
303-
try:
304-
body = json.loads(body)
305-
except json.decoder.JSONDecodeError: # str not bytes
303+
if body:
304+
try:
305+
body = json.loads(body)
306+
except json.decoder.JSONDecodeError: # str not bytes
307+
body = {}
308+
else:
306309
body = {}
307310
# /tablename(PartitionKey='<partition-key>',RowKey='<row-key>')
308311
resource_name = path.split("/", 1)[1] if "/" in path else path

0 commit comments

Comments
 (0)