Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allows custom entity bodies to be sent in PUT and POST requests #70

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
116 changes: 46 additions & 70 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

16 changes: 12 additions & 4 deletions src/Codeception/Module/REST.php
Expand Up @@ -138,10 +138,18 @@ protected function execute($method='GET', $url, $parameters=array(), $files = ar
foreach ($this->headers as $header => $val) {
$this->client->setServerParameter("HTTP_$header", $val);
}
$url = $this->config['url'].$url;
$parameters = $this->stringifyArray($parameters);
$this->debugSection("Request","$method $url?".http_build_query($parameters));
$this->client->request($method, $url, $parameters, $files);

$url = $this->config['url'] . $url;

if (is_array($parameters) || $method == 'GET') {
$parameters = $this->stringifyArray($parameters);
$this->debugSection("Request", "$method $url?" . http_build_query($parameters));
$this->client->request($method, $url, $parameters, $files);
} else {
$this->debugSection("Request", "$method $url " . $parameters);
$this->client->request($method, $url, array(), $files, array(), $parameters);
}

$this->response = $this->client->getResponse()->getContent();
$this->debugSection("Response", $this->response);
}
Expand Down