Releases: Codeception/module-rest
Releases · Codeception/module-rest
3.0.0
2.0.1
- Update dependencies (#67)
- Updating docs to new default algo sha1 by @ThomasLandauer in #66
2.0.0
What's Changed
- PHP 7.4 or higher is required.
- Updated code base to PHP 7.4 by @TavoNiievez in #57 and #65
Full Changelog: 1.4.2...2.0.0
Added JSON check to `AsJson`
Added seeResponseIsJson()
to send*AsJson
actions
AsJson Step Decorator
Step descorator AsJson
was introduced to simplify sending and parsing JSON requests and responses.
Add it to suite configuration:
actor: ApiTester
step_decorators:
- \Codeception\Step\AsJson
or if you use API template:
suites:
api:
actor: ApiTester
step_decorators:
- \Codeception\Step\AsJson
Rebuild actions:
./vendor/bin/codecept build
And you get new actions:
sendPostAsJson
sendGetAsJson
... basically all send*
methods will receive AsJson
pair which sends request in JSON and returns parsed response:
<?php
$user = $I->sendPostAsJson('user', ['id' => 1]);
codecept_debug($user['id'])
$I->assertEquals(1, $user['id'])
return response on send* actions
send* actions were updated to return a response:
$response = $I->sendGet('/users');
$response = $I->sendPost('/users', ['name' => 'jon']);
$response = $I->sendPut('/users/1', ['name' => 'jon']);
$response = $I->sendPatch('/users/1', ['name' => 'jon']);
$response = $I->sendDelete('/users/1');
$response = $I->send('PATCH','/users/1', ['name' => 'jon']);
1.3.2
- Preserve zero fraction when encoding json #63 by @RusiPapazov
DELETE method sends request body
Revert change implemented in 1.3.0
1.3.0
- Add generic send method taking HTTP method as parameter
- Don't send request body with DELETE and OPTIONS requests
- Validate url and params parameters of all send methods
- Document that sendPost, sendPut, sendPatch methods accept string and JsonSerializable as params too
- Other documentation improvements
1.2.8
Append query params to URL for HEAD requests