[Catalyst] Testing RESTful web services

Ian Docherty catalyst at iandocherty.com
Sun Oct 5 09:47:37 BST 2008


Hi
I am writing a simple test to test a POST method in a web service but my 
controller does not see any content in the POSTed request.

In the controller both the $c->request->body and 
$c->request->content_length are undefined.

Any ideas?

------ test.t -------
use strict;
use warnings;

use Catalyst::Test 'MyApp';
use HTTP::Request;

my $req = HTTP::Request->new(
    'POST',
    '/foo',
    [
        Content_Type => 'text/plain'
    ],
    "hello world",
    );

my $response = request($req);

-------------





More information about the Catalyst mailing list