Skip to content

Commit 66f06c9

Browse files
Update InnerBrowser.php: Deprecate deleteHeader in favor of unsetHeader (#69)
1 parent 12dadcf commit 66f06c9

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

src/Codeception/Lib/InnerBrowser.php

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -365,27 +365,35 @@ public function haveHttpHeader(string $name, string $value): void
365365
}
366366

367367
/**
368-
* Deletes the header with the passed name. Subsequent requests
369-
* will not have the deleted header in its request.
368+
* Unsets a HTTP header (that was originally added by [haveHttpHeader()](#haveHttpHeader)),
369+
* so that subsequent requests will not send it anymore.
370370
*
371371
* Example:
372372
* ```php
373373
* <?php
374374
* $I->haveHttpHeader('X-Requested-With', 'Codeception');
375375
* $I->amOnPage('test-headers.php');
376376
* // ...
377-
* $I->deleteHeader('X-Requested-With');
377+
* $I->unsetHeader('X-Requested-With');
378378
* $I->amOnPage('some-other-page.php');
379379
* ```
380380
*
381-
* @param string $name the name of the header to delete.
381+
* @param string $name the name of the header to unset.
382382
*/
383-
public function deleteHeader(string $name): void
383+
public function unsetHeader(string $name): void
384384
{
385385
$name = implode('-', array_map('ucfirst', explode('-', strtolower(str_replace('_', '-', $name)))));
386386
unset($this->headers[$name]);
387387
}
388388

389+
/**
390+
* @deprecated Use [unsetHttpHeader](#unsetHttpHeader) instead
391+
*/
392+
public function deleteHeader(string $name): void
393+
{
394+
$this->unsetHttpHeader($name);
395+
}
396+
389397
public function amOnPage(string $page): void
390398
{
391399
$this->_loadPage('GET', $page);

0 commit comments

Comments
 (0)