mercredi 6 mai 2015

Codeception not setting headers

I have the following functional test set up

$I = new FunctionalTester($scenario);
$I->wantTo('get a list of users');

$key = $I->amApiAuthenticated();
$I->seeInSession('key');
$I->setHeader('X-API-KEY', $key);    
$I->sendAjaxGetRequest('/api/users');
$I->seeResponseCodeIs(200);

But the test fails because the X-API-KEY is not set (results in a 403), this is the request as dumped to a log file from Laravel:

[2015-05-07 00:26:10] production.INFO: GET /api/users HTTP/1.1
Accept:           text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Charset:   ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Language:  en-us,en;q=0.5
Host:             localhost
User-Agent:       Symfony2 BrowserKit
X-Requested-With: XMLHttpRequest

Am I missing something here? Any help would be much appreciated!

Aucun commentaire:

Enregistrer un commentaire