<html><head></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Dec 28, 2010, at 10:44 PM, Bill Moseley wrote:</div><blockquote type="cite"><div class="gmail_quote"><div><font class="Apple-style-span" color="#000000"><br></font></div><div>Are you asking how to make requests with specific HTTP methods (GET, PUT, POST, DELETE)?&nbsp;</div><div><br></div><div>I use a module that basically does this:</div><div><br></div></div><blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;">

<div class="gmail_quote"><div>$cookie_jar-&gt;add_cookie_header( $request );</div><div>my $cgi = HTTP::Request::AsCGI-&gt;new( $request, %ENV )-&gt;setup;</div></div><div class="gmail_quote"><div><div>$app_name-&gt;handle_request;</div>

</div></div><div class="gmail_quote"><div>my $response = $cgi-&gt;restore-&gt;response;</div></div><div class="gmail_quote"><div>$response-&gt;request( $request );</div><div>$cookie_jar-&gt;extract_cookies( $response );</div>

</div></blockquote><div class="gmail_quote"><div><br></div><div>where $request is an HTTP::Request. &nbsp;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.</div>

</div></blockquote></div><div><br></div><div>Right.&nbsp;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-&gt;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. &nbsp;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..</div><div><br></div><div>thanks,</div><div><br></div><div>-jr</div><div><br></div><div><br></div><br></body></html>