-
Notifications
You must be signed in to change notification settings - Fork 113
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
iSendARequestWithValues - encoding body? #21
Comments
The Gherkin step is not meant to contain a json string inside the table |
Well, how could I accomplish what I am trying to do? To send a POST request with some fields. |
This extension is meant to submit a request in JSON format, not in form-url-encoded format |
In my case, the POST data was not being received by my API. When I changed the function to read as follows, my issue was solved. /**
* Sends HTTP request to specific URL with field values from Table.
*
* @param string $method request method
* @param string $url relative url
* @param TableNode $post table of post values
*
* @When /^(?:I )?send a ([A-Z]+) request to "([^"]+)" with values:$/
*/
public function iSendARequestWithValues($method, $url, TableNode $post)
{
$url = $this->prepareUrl($url);
$data = ['query' => $post->getRowsHash()];
$this->request = $this->getClient()->createRequest($method, $url, $data);
$this->sendRequest();
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The following method:
Does not work, when the
$fields
is json encoded. When removing that line, it works perfectly. I.e, like this:Now, before I submit a pull request, I want to make sure I am not getting something wrong? The bug seems too obvious.
I am testing with this data:
The text was updated successfully, but these errors were encountered: