[Catalyst-dev] Catalyst::Test and POSTing non-form data
Rafael Kitover
rkitover at io.com
Mon Aug 18 19:03:32 BST 2008
Here's a small patch which adds a Content-Length header if it's not in
the request object passed to Catalyst::Test
Index: lib/Catalyst/Utils.pm
===================================================================
--- lib/Catalyst/Utils.pm (revision 8230)
+++ lib/Catalyst/Utils.pm (working copy)
@@ -233,6 +233,13 @@
unless ( ref $request eq 'HTTP::Request' ) {
$request = HTTP::Request->new( 'GET', $request );
}
+
+ if (defined $request->content
+ && !defined $request->header('Content-Length')) {
+ use bytes;
+ $request->header('Content-Length' => length $request->content);
+ }
+
return $request;
}
More information about the Catalyst-dev
mailing list