Open
Description
I was investigating an issue in our app until I realized there is a bug in Catalyst itself.
How to reproduce:
- have an app read
$c->req->body_data
—I tried this with a fresh app created bycatalyst.pl
by just adding that call to the default action method - send invalid JSON like this:
curl -v --json '' http://localhost:3000/
Actual result:
[error] Error Parsing POST 'undef', Error: Can't locate object method "getline" via package "0" (perhaps you forgot to load "0"?) at .../perlbrew/perls/perl-5.38.0-threads-bullseye/lib/site_perl/5.38.0/Catalyst.pm line 4091.
Expected result:
- either
return ();
or a catchable exception from parsing the empty string
I think Pull Request #186 solves part of the problem related with repeated calls on $c->req->body_data
but with that the code already fails on $fh->seek
(see my comment there). Currently the data handler fails for $fh->getline
.
Should the data handler always receive a filehandle, possibly an empty one, or does every data handler need to check whether a filehandle is present first?
Metadata
Metadata
Assignees
Labels
No labels