{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/3069","repository_url":"https://api.github.com/repos/Codeception/Codeception","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/3069/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/3069/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/3069/events","html_url":"https://github.com/Codeception/Codeception/issues/3069","id":152539762,"number":3069,"title":"codeception api testing error 401","user":{"login":"FaheemSultan","id":18255194,"avatar_url":"https://avatars.githubusercontent.com/u/18255194?v=3","gravatar_id":"","url":"https://api.github.com/users/FaheemSultan","html_url":"https://github.com/FaheemSultan","followers_url":"https://api.github.com/users/FaheemSultan/followers","following_url":"https://api.github.com/users/FaheemSultan/following{/other_user}","gists_url":"https://api.github.com/users/FaheemSultan/gists{/gist_id}","starred_url":"https://api.github.com/users/FaheemSultan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FaheemSultan/subscriptions","organizations_url":"https://api.github.com/users/FaheemSultan/orgs","repos_url":"https://api.github.com/users/FaheemSultan/repos","events_url":"https://api.github.com/users/FaheemSultan/events{/privacy}","received_events_url":"https://api.github.com/users/FaheemSultan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/Codeception/Codeception/labels/REST","name":"REST","color":"bdc3c7"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2016-05-02T12:00:02Z","updated_at":"2016-05-03T10:14:02Z","closed_at":"2016-05-03T10:06:30Z","body":"I'm new to Codeception. I wrote a test case to call a server time api built in Yii2 and see the return code 200. I executed it also in debug mode where I can see the response as expected but it always returns 401.\r\n\r\nHere is my GetServerTime.php\r\n```php\r\n<?php\r\n$I = new ApiTester($scenario);\r\n$I->wantTo('check server time');\r\n$I->haveHttpHeader('Content-Type', 'application/x-www-form-urlencoded');\r\n$I->sendGET('http://192.168.1.142/api/server/time',array('service' => \"betaserver\"));\r\n$I->seeResponseCodeIs(200);\r\n$I->seeResponseIsJson();\r\n```\r\nI've also used amDigestAuthentication but it didnt work.\r\n\r\nHere is my api.suite.dist.yml file:\r\n```yaml\r\nclass_name: ApiTester\r\nmodules:\r\n    enabled:\r\n        - PhpBrowser:\r\n            url: http://192.168.1.142    \r\n        - REST:\r\n            depends: PhpBrowser\r\n            url: http://192.168.1.142/api/server/time\r\n            part: Json\r\n        - \\Helper\\Api\r\n```\r\nnote that i'm not using any Yii2 configuration, I simply installed Codeception with composer\r\nHere is the response I get \r\n```\r\nCheck server time (GetServerTimeCept)\r\nScenario:\r\n* I have http header \"Content-Type\",\"application/x-www-form-urlencoded\"\r\n* I send get \"http://192.168.1.142/api/server/time\",{\"service\":\"betaserver\"}\r\n\r\n  [Request headers] {\"Content-Type\":\"application/x-www-form-urlencoded\"}\r\n  [Request] GET http://192.168.1.142/api/server/time?service=betaserver\r\n  [Response] \r\n  [Headers] {\"Server\":[\"nginx/1.1.19\"],\"Date\":[\"Mon, 02 May 2016 11:38:15 GMT\"],\"Content-Type\":[\"text/html; charset=utf-8\"],\"Transfer-Encoding\":[\"chunked\"],\"Connection\":[\"keep-alive\"],\"X-Powered-By\":[\"PHP/5.5.32-1+deb.sury.org~precise+1\"],\"Set-Cookie\":[\"PHPSESSID=75kmo4dr54qun8prdtl0rtcup1; path=/; HttpOnly\"],\"Expires\":[\"Thu, 19 Nov 1981 08:52:00 GMT\"],\"Cache-Control\":[\"no-store, no-cache, must-revalidate, post-check=0, pre-check=0\"],\"Pragma\":[\"no-cache\"],\"WWW-Authenticate\":[\"Digest realm=\"service\",qop=\"auth\",nonce=\"57273c272d1c12.34670527\",opaque=\"aaabf0d39951f3e6c3e8a7911df524c2\"\"]}\r\n  [Status] 401\r\n* I see response code is 200\r\n FAIL \r\n\r\nTime: 291 ms, Memory: 13.00Mb\r\n\r\nThere was 1 failure:\r\n\r\n---------\r\n1) Failed to check server time in GetServerTimeCept (tests/api/GetServerTimeCept.php)\r\n\r\n Step  I see response code is 200\r\n Fail  Failed asserting that 401 matches expected 200.\r\n\r\nScenario Steps:\r\n\r\n 3. $I->seeResponseCodeIs(200) at tests/api/GetServerTimeCept.php:6\r\n 2. $I->sendGET(\"http://192.168.1.142/api/server/time\",{\"service\":\"betaserver\"}) at tests/api/GetServerTimeCept.php:5\r\n 1. $I->haveHttpHeader(\"Content-Type\",\"application/x-www-form-urlencoded\") at tests/api/GetServerTimeCept.php:4\r\n\r\n\r\nFAILURES!\r\nTests: 1, Assertions: 1, Failures: 1.\r\n```"},"comment":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/comments/216487624","html_url":"https://github.com/Codeception/Codeception/issues/3069#issuecomment-216487624","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/3069","id":216487624,"user":{"login":"FaheemSultan","id":18255194,"avatar_url":"https://avatars.githubusercontent.com/u/18255194?v=3","gravatar_id":"","url":"https://api.github.com/users/FaheemSultan","html_url":"https://github.com/FaheemSultan","followers_url":"https://api.github.com/users/FaheemSultan/followers","following_url":"https://api.github.com/users/FaheemSultan/following{/other_user}","gists_url":"https://api.github.com/users/FaheemSultan/gists{/gist_id}","starred_url":"https://api.github.com/users/FaheemSultan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/FaheemSultan/subscriptions","organizations_url":"https://api.github.com/users/FaheemSultan/orgs","repos_url":"https://api.github.com/users/FaheemSultan/repos","events_url":"https://api.github.com/users/FaheemSultan/events{/privacy}","received_events_url":"https://api.github.com/users/FaheemSultan/received_events","type":"User","site_admin":false},"created_at":"2016-05-03T10:14:02Z","updated_at":"2016-05-03T10:14:02Z","body":"yes, the status code i'm getting is 401, you can see on the response i pasted above"}}