Skip to content

Instantly share code, notes, and snippets.

@SpiceMan
Created December 15, 2014 05:06
Show Gist options
  • Save SpiceMan/28d66964367761e90374 to your computer and use it in GitHub Desktop.
Save SpiceMan/28d66964367761e90374 to your computer and use it in GitHub Desktop.
package MyApp::Controler::Root;
# blah blah blah
sub bar :Local Args(0) POST Consumes(JSON) {
my( $self, $c ) = @_;
# do nothing, just calling it to make sure _build_body_data runs
my $foo = $c->req->body_data;
# $c->req->body_data == undef from now on
}
__DATA__
$ curl -X POST -H "Content-type: application/json" localhost:3000/bar
[info] *** Request 1 (0.038/s) [18396] [Mon Dec 15 14:04:47 2014] ***
[debug] Path is "bar"
[debug] "POST" request for "bar" from "127.0.0.1"
[error] Caught exception in MyApp::Controller::Root->bar "Can't locate object method "getline" via package "0" (perhaps you forgot to load "0"?) at /opt/perl5/perls/perl-5.18.2/lib/site_perl/5.18.2/Catalyst.pm line 3438."
[debug] Response Code: 500; Content-Type: text/html; charset=utf-8; Content-Length: unknown
[info] Request took 0.012679s (78.871/s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment