Sanpi\Behatch\Context\RestContext::iSendARequestToWithParameters PHP Method

iSendARequestToWithParameters() public method

Sends a HTTP request with a some parameters
public iSendARequestToWithParameters ( $method, $url, Behat\Gherkin\Node\TableNode $datas )
$datas Behat\Gherkin\Node\TableNode
    public function iSendARequestToWithParameters($method, $url, TableNode $datas)
    {
        $files = [];
        $parameters = [];
        foreach ($datas->getHash() as $row) {
            if (!isset($row['key']) || !isset($row['value'])) {
                throw new \Exception("You must provide a 'key' and 'value' column in your table node.");
            }
            if (is_string($row['value']) && substr($row['value'], 0, 1) == '@') {
                $files[$row['key']] = rtrim($this->getMinkParameter('files_path'), DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . substr($row['value'], 1);
            } else {
                $parameters[] = sprintf('%s=%s', $row['key'], $row['value']);
            }
        }
        parse_str(implode('&', $parameters), $parameters);
        return $this->request->send($method, $this->locatePath($url), $parameters, $files);
    }