deleteHeader not supported by REST module #3161

Closed
mrtndwrd opened this Issue Jun 3, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@mrtndwrd
Contributor

mrtndwrd commented Jun 3, 2016

The documentation of the REST module suggests using the "deleteHeader" function to undo the "haveHttpHeader" function: http://codeception.com/docs/modules/REST#haveHttpHeader. The deleteHeader function is however currently only implemented in the PhpBrowser module, which uses setHeader, which is ignored by the REST module.

Using deleteHeader after using haveHttpHeader does not seem to have any effect.

code sample:

$I = new ApiTester($scenario);
$I->wantTo("do two things");
$I->amBearerAuthenticated(Fixtures::get('apikey'));
$I->haveHttpHeader('Content-Type', 'application/json');
$I->sendPOST('/action/',
    [
        'name' => 'action 1'
    ]
);
$I->seeResponseCodeIs(200);

// Now do a sendDELETE, which should not have application/json in its header:
$I->deleteHeader('Content-Type');
$I->sendDELETE("/action/1");
$I->seeResponseCodeIs(204);

api.suite.yml:

class_name: ApiTester
modules:
    enabled:
        - REST:
            url: http://localhost/api/v2/
            depends: PhpBrowser
            part: Json
        - PhpBrowser

Removing - PhpBrowser from the last line results in an error that function deleteHeader() does not exist.

Naktibalda added a commit to Naktibalda/Codeception that referenced this issue Jun 6, 2016

@DavertMik DavertMik closed this in #3183 Jun 7, 2016

DavertMik added a commit that referenced this issue Jun 7, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment