From a585f0b526ab8810c71d0d3e93a0bde008e1b9c8 Mon Sep 17 00:00:00 2001 From: Sanpi Date: Thu, 9 Aug 2018 17:57:48 +0200 Subject: [PATCH] [rest] Allows parameters with dot --- src/Context/RestContext.php | 4 +--- tests/features/rest.feature | 7 +++++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Context/RestContext.php b/src/Context/RestContext.php index a3173a7a..dd1d21f8 100644 --- a/src/Context/RestContext.php +++ b/src/Context/RestContext.php @@ -54,12 +54,10 @@ public function iSendARequestToWithParameters($method, $url, TableNode $data) $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']); + $parameters[$row['key']] = $row['value']; } } - parse_str(implode('&', $parameters), $parameters); - return $this->request->send( $method, $this->locatePath($url), diff --git a/tests/features/rest.feature b/tests/features/rest.feature index d113be26..39d79538 100644 --- a/tests/features/rest.feature +++ b/tests/features/rest.feature @@ -51,6 +51,13 @@ Feature: Testing RESTContext """ Then the response should be empty + Scenario: request parameter with dot + https://github.com/Behatch/contexts/issues/256 + When I send a POST request to "/rest/index.php" with parameters: + | key | value | + | item.id | 1 | + Then I should see "item.id=1" + Scenario: Add header Given I add "xxx" header equal to "yyy" When I send a GET request to "/rest/index.php"