diff --git a/docs/.vitepress/config.ts b/docs/.vitepress/config.ts index adc82aae..7c128d83 100644 --- a/docs/.vitepress/config.ts +++ b/docs/.vitepress/config.ts @@ -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', }, ] }, { diff --git a/docs/api/settings/removeDefaultHeaders.md b/docs/api/settings/removeDefaultHeaders.md new file mode 100644 index 00000000..854a25a3 --- /dev/null +++ b/docs/api/settings/removeDefaultHeaders.md @@ -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); +``` \ No newline at end of file