Skip to content
Merged
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
1 change: 1 addition & 0 deletions CHANGELOG.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ endif::[]
===== Bug fixes

* Fix for potential `capture_body: error` hang in Starlette/FastAPI {pull}1038[#1038]
* Fix for Starlette/FastAPI to correctly capture request bodies as strings {pull}1042[#1041]


[[release-notes-6.x]]
Expand Down
6 changes: 0 additions & 6 deletions elasticapm/contrib/starlette/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

import json

from starlette.requests import Request
from starlette.responses import Response
from starlette.types import Message
Expand Down Expand Up @@ -64,10 +62,6 @@ async def get_data_from_request(request: Request, config: Config, event_type: st
body = None
try:
body = await get_body(request)
if request.headers.get("content-type") == "application/x-www-form-urlencoded":
body = await query_params_to_dict(body)
else:
body = json.loads(body)
except Exception:
pass
if body is not None:
Expand Down
2 changes: 1 addition & 1 deletion tests/contrib/asyncio/starlette_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def test_post(app, elasticapm_client):
request = transaction["context"]["request"]
assert request["method"] == "POST"
assert request["socket"] == {"remote_address": "127.0.0.1", "encrypted": False}
assert request["body"]["foo"] == "bar"
assert request["body"] == "foo=bar"

assert span["name"] == "test"

Expand Down