Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 27 additions & 20 deletions src/Codeception/Module/REST.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,33 +25,40 @@
/**
* Module for testing REST WebService.
*
* This module can be used either with frameworks or PHPBrowser.
* If a framework module is connected, the testing will occur in the application directly.
* Otherwise, a PHPBrowser should be specified as a dependency to send requests and receive responses from a server.
* This module requires either [PhpBrowser](https://codeception.com/docs/modules/PhpBrowser)
* or a framework module (e.g. [Symfony](https://codeception.com/docs/modules/Symfony), [Laravel](https://codeception.com/docs/modules/Laravel5))
* to send the actual HTTP request.
*
* ## Configuration
*
* * url *optional* - the url of api
* * shortDebugResponse *optional* - amount of chars to limit the api response length
* * `url` *optional* - the url of api
* * `shortDebugResponse` *optional* - number of chars to limit the API response length
*
* This module requires PHPBrowser or any of Framework modules enabled.
* ### Example
*
* In case you need to configure low-level HTTP fields, that's done on the PHPBrowser level.
* Check the example below for details.
* ```yaml
* modules:
* enabled:
* - REST:
* depends: PhpBrowser
* url: 'https://example.com/api/v1/'
* shortDebugResponse: 300 # only the first 300 characters of the response
* ```
*
* ### Example
* In case you need to configure low-level HTTP headers, that's done on the PhpBrowser level like so:
*
* modules:
* enabled:
* - REST:
* depends: PhpBrowser
* url: &url 'http://serviceapp/api/v1/' # you only need the &url anchor for further PhpBrowser configs
* shortDebugResponse: 300 # only the first 300 chars of the response
* config:
* PhpBrowser:
* url: *url # repeats the URL from the REST module; not needed if you don't have further settings like below
* headers:
* Content-Type: application/json
* ```yaml
* modules:
* enabled:
* - REST:
* depends: PhpBrowser
* url: &url 'https://example.com/api/v1/'
* config:
* PhpBrowser:
* url: *url
* headers:
* Content-Type: application/json
* ```
*
* ## Public Properties
*
Expand Down