Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deleteHeader not supported by REST module #3161

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

deleteHeader not supported by REST module #3161

mrtndwrd opened this issue Jun 3, 2016 · 0 comments

Comments

@mrtndwrd
Copy link
Contributor

@mrtndwrd 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 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
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.