Skip to content

TEST.clearRequestHeaders() ​

Clears all custom HTTP request headers configured on the browser proxy.

After this command executes, the proxy will no longer inject any custom headers into outbound browser requests, returning the browser session network state to its clean baseline.

Usage ​

js
TEST.clearRequestHeaders()
TEST.clearRequestHeaders(options)

Parameters ​

ParameterTypeDescription
optionsobjectOptional configuration options (see below).

Options Object ​

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

Variants ​

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

Examples ​

Reset Headers Between Test Scenarios ​

js
// Scenario 1: Run with staging and internal testing headers
TEST.setRequestHeaders({
    "X-Environment": "staging",
    "X-Internal-Bypass": "secret_key"
})
I.goTo("https://example.com/feature-test")
I.see("Staging Environment")

// Scenario 2: Clear all headers to test default public customer behavior
TEST.clearRequestHeaders()
I.goTo("https://example.com")
I.see("Welcome to Example Store")

Provide a Custom Step Message ​

js
TEST.clearRequestHeaders({
    msg: "Clear all proxy headers before next test phase"
})

Silently Clear Headers ($$) ​

js
// Silently reset proxy headers without adding noise to the test report
TEST.clearRequestHeaders$$()