PSGI/Plack is an abstraction around HTTP. Its goal is not to have to bother about the implementation details (as much as without it). At the time your app sees the request, it's already been parsed into the $env
and is in Plack's representation.
You could monkey-patch something into Plack::HTTPParser::PP to dump the $chunk
s out to see what's coming in. You would have to set PLACK_HTTP_PARSER_PP=1
in your environment to make sure it loads the pure Perl version.
However that seems really tedious. If you're on Linux, you can use netcat (nc
). Listen on your port, and send requests there with the client you are testing.
$ nc -l 3000
GET / HTTP/1.1
Host: localhost:3000
User-Agent: curl/7.68.0
Accept: */*
And on another terminal...
$ curl localhost:3000
If you don't care about the exact representation, but only about whether it's got the right stuff in it after parsing, start by dumping out $env
in your Plack app instead.
$env
or turn the Plack::Request into a string, but you'd have to hook into the request parser to get a dump out, I think. Or you could hook into your server. – simbabque