Skip to content

Commit 82dea2e

Browse files
committed
test: add step to set mock response with explicit header
Add 'set the response with :header header :value to:' step to the test FeatureContext so scenarios can control the Content-Type (or any other header) of the mock server response, making header assertion scenarios deterministic. Signed-off-by: Vitor Mattos <1079143+vitormattos@users.noreply.github.com>
1 parent 0526d97 commit 82dea2e

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

features/bootstrap/FeatureContext.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,14 @@ public function setTheResponseTo(PyStringNode $response): void {
139139
));
140140
}
141141

142+
#[Given('set the response with :header header :value to:')]
143+
public function setTheResponseWithHeaderTo(string $header, string $value, PyStringNode $response): void {
144+
$this->mockServer->setDefaultResponse(new MockWebServerResponse(
145+
(string) $response,
146+
[$header => $value]
147+
));
148+
}
149+
142150
/**
143151
* @inheritDoc
144152
*/

0 commit comments

Comments
 (0)