【发布时间】:2014-10-17 07:49:51
【问题描述】:
我用提琴手向服务器发送请求,它发送响应
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 错误
【问题讨论】:
标签: codeception