-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added doc for removeDefaultHeaders (#52)
- Loading branch information
Showing
2 changed files
with
47 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
# removeDefaultHeaders | ||
|
||
use to remove default headers for all the requests. | ||
|
||
## Syntax | ||
|
||
```js | ||
removeDefaultHeaders() | ||
removeDefaultHeaders(key) | ||
``` | ||
|
||
## Usage | ||
|
||
### ✅ Correct Usage | ||
|
||
```js | ||
// without specifying any 'key' will remove all the default headers | ||
request.removeDefaultHeaders() | ||
``` | ||
|
||
```js | ||
// by specifying 'key' will remove only the specific default header | ||
request.removeDefaultHeaders('Authorization') | ||
``` | ||
|
||
## Arguments | ||
|
||
#### > key (string) | ||
|
||
header key | ||
|
||
|
||
## Examples | ||
|
||
### Normal | ||
|
||
```js | ||
const { spec, request } = require('pactum'); | ||
|
||
request.setDefaultHeaders({ 'key': 'value', 'key1': 'value1' }); | ||
request.removeDefaultHeaders('key'); | ||
|
||
await spec() | ||
.get('https://randomuser.me/api') | ||
.expectStatus(200); | ||
``` |