On Dec 28, 2010, at 10:44 PM, Bill Moseley wrote:
> 
> Are you asking how to make requests with specific HTTP methods (GET, PUT, 
> POST, DELETE)? 
> 
> I use a module that basically does this:
> 
> $cookie_jar->add_cookie_header( $request );
> my $cgi = HTTP::Request::AsCGI->new( $request, %ENV )->setup;
> $app_name->handle_request;
> my $response = $cgi->restore->response;
> $response->request( $request );
> $cookie_jar->extract_cookies( $response );
> 
> where $request is an HTTP::Request.  I wrap that with some utility methods to 
> make creating the requests easier and to encode/decode json and set headers 
> to emulate AJAX, etc.


Right. I suppose the only option is to create my own HTTP::Request object, set 
content and content-type header and then send it to $mech->request(...). It 
would be nice if post_ok() would somehow allow us to specify the actual content 
of the request and headers like Content-Type. As implemented right now 
post_ok() only allows you to specify content for form fields which are 
form-urlencoded into the body of the request.  Would be nice to have a 
request_ok() method similar to the post_ok() methods which allow us to specify 
our own HTTP::Request objects. This would be in Test::WWW::Mechanize though..

thanks,

-jr



_______________________________________________
List: [email protected]
Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst
Searchable archive: http://www.mail-archive.com/[email protected]/
Dev site: http://dev.catalyst.perl.org/

Reply via email to