Skip to content

TEST.deleteRequestHeader() ​

Deletes a single HTTP request header from the browser proxy.

Other active headers configured on the proxy remain unaffected. Once deleted, subsequent browser requests will no longer include this header.

TIP

To remove all headers at once, use TEST.clearRequestHeaders(). Alternatively, calling TEST.setRequestHeader(name, null) also deletes the specified header.

Usage ​

js
TEST.deleteRequestHeader(name)
TEST.deleteRequestHeader(name, options)

Parameters ​

ParameterTypeDescription
namestringRequired.
Name of the HTTP request header to delete. Must be a non-empty string.
optionsobjectOptional configuration options (see below).

Options Object ​

OptionTypeDescription
msgstringCustom description message displayed for this step in the test report.

Variants ​

  • TEST.deleteRequestHeader(): Standard execution. Logs the step to the test report and throws an error if name is empty or if the proxy fails.
  • TEST.deleteRequestHeader$(): Error suppression mode. If an error occurs, catches the error and continues test execution without failing the step.
  • TEST.deleteRequestHeader$$(): Silent mode. Suppresses errors and hides the command step from the test report logs.

Examples ​

Remove Authorization to Test Guest Flow ​

js
// 1. Perform admin setup with authorization header
TEST.setRequestHeader("Authorization", "Bearer admin_token_123")
I.goTo("https://store.example.com/admin/inventory")
I.see("Inventory Manager")

// 2. Remove authorization header to test unauthenticated checkout
TEST.deleteRequestHeader("Authorization")
I.goTo("https://store.example.com/cart")
I.see("Guest Checkout")

Delete a Feature Gate Header ​

js
// Remove feature flag header to verify standard production behavior
TEST.deleteRequestHeader("X-Feature-Gate", {
    msg: "Remove beta feature gate header"
})