diff --git a/flask_profiler/flask_profiler.py b/flask_profiler/flask_profiler.py index 2103d9f..05a405d 100644 --- a/flask_profiler/flask_profiler.py +++ b/flask_profiler/flask_profiler.py @@ -3,7 +3,7 @@ import functools import re import time - +import json from pprint import pprint as pp import logging @@ -123,11 +123,14 @@ def wrapper(*args, **kwargs): def wrapHttpEndpoint(f): @functools.wraps(f) def wrapper(*args, **kwargs): + body = request.data.decode("utf-8", "strict") + if body: + body = json.loads(body) context = { "url": request.base_url, "args": dict(request.args.items()), "form": dict(request.form.items()), - "body": request.data.decode("utf-8", "strict"), + "body": body, "headers": dict(request.headers.items()), "func": request.endpoint, "ip": request.remote_addr