首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Codeception API测试响应错误

Codeception API测试响应错误
EN

Stack Overflow用户
提问于 2014-10-17 15:49:51
回答 1查看 333关注 0票数 0

我用fiddler向服务器发送请求,它发送响应

代码语言:javascript
复制
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

我想用共同欺骗来检查这个

代码语言:javascript
复制
    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错误

EN

回答 1

Stack Overflow用户

发布于 2014-12-10 16:10:23

如果你用--debug这样运行它会怎么样?它是否提供了出错原因的任何细节?

代码语言:javascript
复制
codecept.phar run --debug
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/26420330

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档