I'm afraid I didn't get the attachment, so apologies if this guess is out, but are you setting the content-length on your HTTP::Request? If not, have a look at how HTTP::Request::Common does it - https://metacpan.org/source/ETHER/HTTP-Message-6.11/lib/HTTP/Request/Common.... - (or indeed just use HTTP::Request::Common itself). Daniel -----Original Message----- From: dancer-users [mailto:dancer-users-bounces@dancer.pm] On Behalf Of Lennart Hengstmengel Sent: 22 July 2016 12:38 To: dancer-users@dancer.pm Subject: [dancer-users] "Route exception: Bad Content-Length: maybe client disconnect?" with JSON POST and request->content Hi all, I'm running into an issue that looks like a bug, but I'm unsure where it comes from. Could be in Dancer2, but maybe in Plack::Request, or even in Plack::Test, HTTP::Request, or somewhere else. I'm kinda lost in the woods. I was hoping that a mind greater than mine can shed some light on this. I get an error "Route exception: Bad Content-Length: maybe client disconnect? (xx bytes remaining)" where xx is the total content length of the request body. But only under the following conditions: - (valid) JSON POST to a Dancer2 app - the app is configured with serializer = JSON - in the route there's a call to: request->content - using Plack::Test and HTTP::Request Attached is a minimal test to demonstrate the issue. Test no 5 fails. I cannot reproduce this issue when using f.e. curl, this call works without errors: curl --data-binary '{ "foo": "123" }' --header 'Content-type: application/json' http://localhost:3000/nok I am using the latest version of Dancer (0.200003) and also latest CPAN versions of Plack and HTTP::Request. Any insights? Thanks, Lennart