<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<div class="moz-text-html" lang="x-western"> David Wright wrote:
<blockquote cite="mid:48E9C517.3080104@dexy.org" type="cite">
  <pre wrap="">Ian Docherty wrote:
  </pre>
  <blockquote type="cite">
    <pre wrap="">Moritz Onken wrote:
    </pre>
    <blockquote type="cite">
      <pre wrap="">Am 05.10.2008 um 10:47 schrieb Ian Docherty:

      </pre>
      <blockquote type="cite">
        <pre wrap="">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-&gt;request-&gt;body and
$c-&gt;request-&gt;content_length are undefined.

Any ideas?

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

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

my $req = HTTP::Request-&gt;new(
  'POST',
  '/foo',
  [
      Content_Type =&gt; 'text/plain'
  ],
  "hello world",
  );
        </pre>
      </blockquote>
      <pre wrap="">It's Content-type =&gt; ...
      </pre>
    </blockquote>
    <pre wrap="">Yup, typo on my part, but it does not change the problem. There is
still no content in the request when it gets to the controller.
    </pre>
  </blockquote>
  <pre wrap=""><!---->It's not a typo, the constructor accepts underscores as well as dashes
so that you can build requests without having to quote the hash keys.

  </pre>
  <blockquote type="cite">
    <pre wrap="">Just a slight modification to my original statement. In the controller
the request body is undef, but the request length is 0 (not undef)
    </pre>
  </blockquote>
  <pre wrap=""><!---->
IIRC you have to manually add content-length yourself, HTTP::Request
doesn't build it for you.
  </pre>
</blockquote>
Excellent. That was exactly the problem. Thanks.<br>
<blockquote cite="mid:48E9C517.3080104@dexy.org" type="cite">
  <pre wrap="">Regards,
David


_______________________________________________
List: <a class="moz-txt-link-abbreviated"
 href="mailto:Catalyst@lists.scsys.co.uk">Catalyst@lists.scsys.co.uk</a>
Listinfo: <a class="moz-txt-link-freetext"
 href="http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst">http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst</a>
Searchable archive: <a class="moz-txt-link-freetext"
 href="http://www.mail-archive.com/catalyst@lists.scsys.co.uk/">http://www.mail-archive.com/catalyst@lists.scsys.co.uk/</a>
Dev site: <a class="moz-txt-link-freetext"
 href="http://dev.catalyst.perl.org/">http://dev.catalyst.perl.org/</a>

  </pre>
</blockquote>
<br>
</div>
</body>
</html>