Skip to content

Commit

Permalink
Fixing test_request with "POST" option
Browse files Browse the repository at this point in the history
  • Loading branch information
Fabrice Luraine committed May 15, 2010
1 parent 9325f7e commit 6f552f5
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lib/limonade/tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ function test_cli_format($text, $format) {
* @return string
* @author Nando Vieira
*/
function test_request($url, $method="GET", $include_header=false) {
function test_request($url, $method="GET", $include_header=false, $post_data=array()) {
$method = strtoupper($method);
$allowed_methods = array("GET", "PUT", "POST", "DELETE", "HEAD");
if(!in_array($method, $allowed_methods))
Expand All @@ -332,7 +332,11 @@ function test_request($url, $method="GET", $include_header=false) {
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_HEADER, $include_header);
curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
if($method == 'POST') curl_setopt($curl, CURLOPT_POST, 1);
if($method == 'POST')
{
curl_setopt($curl, CURLOPT_POST, 1);
curl_setopt($curl, CURLOPT_POSTFIELDS, $post_data);
}
$response = curl_exec($curl);
curl_close($curl);

Expand Down

0 comments on commit 6f552f5

Please sign in to comment.