Skip to content

Commit

Permalink
added doc for removeDefaultHeaders (#52)
Browse files Browse the repository at this point in the history
  • Loading branch information
raj356 authored Jul 20, 2024
1 parent 65b3daf commit c7cf84d
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,7 @@ const api_sidebar = [
{ text: 'setRequestDefaultRetryCount', link: '/api/settings/setRequestDefaultRetryCount', },
{ text: 'setRequestDefaultRetryDelay', link: '/api/settings/setRequestDefaultRetryDelay', },
{ text: 'setDataDirectory', link: '/api/settings/setDataDirectory', },
{ text: 'removeDefaultHeaders', link: '/api/settings/removeDefaultHeaders', },
]
},
{
Expand Down
46 changes: 46 additions & 0 deletions docs/api/settings/removeDefaultHeaders.md
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);
```

0 comments on commit c7cf84d

Please sign in to comment.