{"action":"created","issue":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/3604","repository_url":"https://api.github.com/repos/Codeception/Codeception","labels_url":"https://api.github.com/repos/Codeception/Codeception/issues/3604/labels{/name}","comments_url":"https://api.github.com/repos/Codeception/Codeception/issues/3604/comments","events_url":"https://api.github.com/repos/Codeception/Codeception/issues/3604/events","html_url":"https://github.com/Codeception/Codeception/issues/3604","id":182502784,"number":3604,"title":"Cannot check headers or grab Content when GET Route returns a File","user":{"login":"kareltrcalek","id":22789234,"avatar_url":"https://avatars.githubusercontent.com/u/22789234?v=3","gravatar_id":"","url":"https://api.github.com/users/kareltrcalek","html_url":"https://github.com/kareltrcalek","followers_url":"https://api.github.com/users/kareltrcalek/followers","following_url":"https://api.github.com/users/kareltrcalek/following{/other_user}","gists_url":"https://api.github.com/users/kareltrcalek/gists{/gist_id}","starred_url":"https://api.github.com/users/kareltrcalek/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kareltrcalek/subscriptions","organizations_url":"https://api.github.com/users/kareltrcalek/orgs","repos_url":"https://api.github.com/users/kareltrcalek/repos","events_url":"https://api.github.com/users/kareltrcalek/events{/privacy}","received_events_url":"https://api.github.com/users/kareltrcalek/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-12T11:34:38Z","updated_at":"2016-10-12T14:51:56Z","closed_at":null,"body":"#### What are you trying to achieve?\r\nI have a GET Route like \r\n```\r\nGET /project/getfile/token HTTP/1.1\r\nHost: ettest03.cld.ondemand.com\r\n```\r\n\r\n which speaks with 3d platform because it internally knows the link to that file via token provided and downloads that pdf or zip file which is then forwarded as a response of my route /project/getfile/token. Response is Phalcon\\Http\\Response Type.\r\nBefore forwarding the file to the end user (browser) or external platform picking up the fila via route above, I set headers:\r\n * Content-Type: application/pdf\r\n * Content-Length: the length of file\r\n * Cache-Control: no-store\r\n\r\nIf you call this Route with valid token in browser, you get directly the pdf or whatever file displayed in browser, also with correct headers.\r\n![response_download](https://cloud.githubusercontent.com/assets/22789234/19308102/30a8301e-907e-11e6-8733-c8ab71889ad3.JPG)\r\n\r\nIf I test this route via Functional Testing, the problem is that I can only check the HTTP Response with _canSeeResponseCodeIs(200)_ and nothing else is working.\r\n I cannot grab Content, I cannot check the headers used\r\n```\r\n$I->seeHttpHeader('Content-Type', 'application/pdf');\r\n$I->canSeeHttpHeader('Content-Type', 'application/pdf');\r\n$I->grabHttpHeader('Content-Type');\r\n$I->haveHttpHeader('Content-Type', 'application/pdf');\r\n$I->canSeeHttpHeaderOnce('Content-Length');\r\n```\r\n\r\nbecause all this methods return **null**.\r\nI am not really interested in testing the download of that file, because that is done on different level, but I wanna check if the test file (pdf, zip, txt) was sent to end user because I explicitly set all the headers like content-length, content type, cache-control, etc.\r\n\r\n The problem is that the response if that route call is not in $I object at all, no headers, no content, nothing.\r\n\r\n#### What do you get instead?\r\nInstead I got from methods mentioned above **null** and I cannot test a single thing coming out from this route with codeception functional tester. I cannot event access the content of response in case I get and send text/plain file.\r\nOf course the whole Cept Test fails.\r\n\r\nAs you can see in output down here, the content of file is not even assigned to correct value but is somehow flying in between and values like Response Headers and Response are empty (Lorem Ipsum etc is the actual content of the txt file in response forwarded via the route to end user).\r\n\r\n> Provide console output if related. Use `-vvv` mode for more details.\r\n\r\n```bash\r\nI send get \"/project/getfile/57fdfa8c5ac39f0350619041\"\r\n  [Request] GET /project/getfile/57fdfa8c5ac39f0350619041\r\n  [Request Headers] []\r\nLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.  [Page] /project/getfile/57fdfa8c5ac39f0350619041\r\n  [Response] 200\r\n  [Request Cookies] []\r\n  [Response Headers] []\r\n  [Response]\r\n I can see response code is 200\r\n I send get \"/project/getfile/57fdfa8c5ac39f0350619042\"\r\n  [Request] GET /project/getfile/57fdfa8c5ac39f0350619042\r\n  [Request Headers] []\r\nLorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.  [Page] /project/getfile/57fdfa8c5ac39f0350619042\r\n  [Response] 200\r\n  [Request Cookies] []\r\n  [Response Headers] []\r\n  [Response]\r\n I can see response code is 200\r\n```\r\n> Provide test source code if related\r\n\r\n```php\r\n$I->sendGET('/project/getfile/' . $token);\r\n$I->canSeeResponseCodeIs(200);\r\n$I->seeHttpHeader('Content-Type', 'application/pdf');\r\n$I->canSeeHttpHeader('Content-Type', 'application/pdf');\r\n$I->grabHttpHeader('Content-Type');\r\n$I->canSeeHttpHeaderOnce('Content-Length');\r\n```\r\n### Details\r\n\r\n* Codeception version:  2.2.x-dev\r\n* PHP Version: 7.0\r\n* Operating System: docker container\r\n* Installation type: Composer\r\n* List of installed packages (`composer show`)\r\n* Suite configuration:\r\n\r\n```yml\r\nclass_name: FunctionalTester\r\nmodules:\r\n    enabled:\r\n        - MongoDb:\r\n            dsn: mongodb://mongo:27017/whateverproject\r\n            populate: false\r\n        - Phalcon:\r\n            bootstrap: '/tests/_bootstrap.php'\r\n            cleanup: true\r\n            savepoints: true\r\n        - REST:\r\n            depends: Phalcon\r\n        - Asserts\r\n        - \\Helper\\Functional\r\nenv:\r\n    travis:\r\n         modules:\r\n            config:\r\n                MongoDb:\r\n                    dsn: mongodb://127.0.0.1:27017/whateverproject\r\n```\r\n"},"comment":{"url":"https://api.github.com/repos/Codeception/Codeception/issues/comments/253235927","html_url":"https://github.com/Codeception/Codeception/issues/3604#issuecomment-253235927","issue_url":"https://api.github.com/repos/Codeception/Codeception/issues/3604","id":253235927,"user":{"login":"Naktibalda","id":395992,"avatar_url":"https://avatars.githubusercontent.com/u/395992?v=3","gravatar_id":"","url":"https://api.github.com/users/Naktibalda","html_url":"https://github.com/Naktibalda","followers_url":"https://api.github.com/users/Naktibalda/followers","following_url":"https://api.github.com/users/Naktibalda/following{/other_user}","gists_url":"https://api.github.com/users/Naktibalda/gists{/gist_id}","starred_url":"https://api.github.com/users/Naktibalda/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Naktibalda/subscriptions","organizations_url":"https://api.github.com/users/Naktibalda/orgs","repos_url":"https://api.github.com/users/Naktibalda/repos","events_url":"https://api.github.com/users/Naktibalda/events{/privacy}","received_events_url":"https://api.github.com/users/Naktibalda/received_events","type":"User","site_admin":false},"created_at":"2016-10-12T14:51:55Z","updated_at":"2016-10-12T14:51:55Z","body":"There are a lot of internal details in https://github.com/Codeception/Codeception/blob/2.2/src/Codeception/Lib/Connector/Phalcon.php"}}
{"actor":{"display_login":"Naktibalda"}}