FAQ

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



-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.scsys.co.uk/pipermail/catalyst/attachments/20101228/1904ba4d/attachment.htm

Search Discussions

Discussion Posts

Previous

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 3 of 8 | next ›
Discussion Overview
groupcatalyst @
categoriescatalyst, perl
postedDec 29, '10 at 12:47a
activeJan 1, '11 at 4:16p
posts8
users4
websitecatalystframework.org
irc#catalyst

People

Translate

site design / logo © 2022 Grokbase