0
我請求發送到與小提琴手服務器,它發送性反應Codeception - API試驗性反應的錯誤
Fiddler url: http://api.demo.loc/lc/
header:User-Agent: Fiddler
Host: api.demo.loc
Content-Type: application/x-www-form-urlencoded
Content-Length: 49
Request body: m=stt&l=2&n=5&news_version=2
我想codeception檢查此
I wrote config like this:
class_name: ApiGuy
modules:
enabled: [PhpBrowser, REST, ApiHelper]
config:
PhpBrowser:
url: http://api.demo.loc/lc/
REST:
url: http://api.demo.loc/lc/
And my code:
<?php
$I = new ApiGuy($scenario);
$I->wantTo('STEP 1');
$I->haveHttpHeader('User-Agent: Codeception', 'Host: api.demo.loc');
$I->haveHttpHeader('Content-Type: application/x-www-form-urlencoded','Content-Length: 49');
// get a succesful response
$I->sendPOST('', array('m' => 'stt','l' => '2', 'n' => '5', 'news_version' => '2'));
$I->seeResponseCodeIs(200);
$I->seeResponseIsJson();
$I->seeResponseContainsJson(array('result' => 'success'));
?>
線seeResponseContainsJson錯誤
也可以在命令末尾加上'--steps'並查看測試過程中的每一步。 – 2017-02-21 14:11:45