elastic / apm-aws-lambda

A repository for the AWS Lambda extension and other lambda related tools and build scripts.
https://www.elastic.co/guide/en/apm/guide/current/monitoring-aws-lambda.html
Apache License 2.0
16 stars 27 forks source link

test: create a new bytes reader instead of sharing bytes buffer #511

Closed kruskall closed 3 months ago

kruskall commented 3 months ago

http requests are sharing a bytes buffer causing the request to fail with

Post "http://localhost:39859/intake/v2/events": http: ContentLength=1082 with Body length 0

Update test to create a bytes reader for each request and check the error to avoid failing silently. Close the response body to avoid leaks or leaving the client in a bad state.