Return raw body for UrlEncoded requests.
authorDavid Precious <davidp@preshweb.co.uk>
Mon, 7 Mar 2016 23:06:36 +0000 (23:06 +0000)
committerDavid Precious <davidp@preshweb.co.uk>
Mon, 7 Mar 2016 23:06:36 +0000 (23:06 +0000)
commit2ec96b56ef1ffe8e1d2194c9ab2783f581acca9f
tree387957700992097f05fdee090602000a1f8b03e9
parent4e0e25dd979941454a9b065abdec5e5319f518cb
Return raw body for UrlEncoded requests.

This is for RT #111876:
https://rt.cpan.org/Public/Bug/Display.html?id=111876

We currently return a body filehandle for OctetStream requests, but not for
UrlEncoded requests, which causes surprises - for e.g. Dancer1 issue:
https://github.com/PerlDancer/Dancer/issues/1140

This change makes parsed UrlEncoded requests store the "raw" body (after parsing
out chunking etc) in $self->body, so the caller can get a filehandle for it just
like they would for an OctetStream request.

Tests updated to expect this new behaviour.

TODO: Decide if we need MultiPart to expose a raw body for consistency (would
anyone ever want the overall raw body for a MultiPart request?) and if so,
cobble together the request as it was (but not storing the form params part to
disk for security)
dist.ini
lib/HTTP/Body/UrlEncoded.pm
t/05urlencoded.t
t/data/urlencoded/001-results.pml
t/data/urlencoded/002-results.pml
t/data/urlencoded/003-results.pml
t/data/urlencoded/004-results.pml
t/data/urlencoded/005-results.pml
t/data/urlencoded/006-results.pml