---
agentTools:
  projectIndex: https://support.speedcurve.com/llms.txt
---

# Add URL pattern filtering to setHeader & addHeader script commands

**14th September 2023 (UTC)**

# Add URL pattern filtering to setHeader & addHeader script commands

The requests that the `setHeader` and `addHeader` script commands apply to can now be restricted by adding a URL pattern to the command.

For example:|

`setHeader x-header-name:value https://www.speedcurve.com/*` adds the header to all requests to <https://www.speedcurve.com>

`setHeader x-header-name:value https://*.speedcurve.com/*` adds the header to all requests to on SpeedCurve's subdomains e.g. <https://support.speedcurve.com>, <https://www.speedcurve.com>, <https://app.speedcurve.com> etc.

`setHeader x-header-name:value https://www.speedcurve.com/` adds the header to just the request <https://www.speedcurve.com/> and not to any other pages, sub-resources, sub-domains etc.

Previously `setHeader` and `addHeader` relied on the Chrome DevTools Protocol `Network.setExtraHTTPHeaders` which adds the header to all requests in a test and this could lead to CORS issues.

If a urlpattern isn't specified then a default pattern of `_://_/*'` is used. This replicates the previous behaviour and applies the header to all requests.

In the future we may update this default to be the domain of the page being tested.

# Resume when JS debugger; command is executed

Our agent connects to Chrome via DevTools Protocol.

When Chrome / V8 encounters a `debugger;`command in the page being tested it pauses the  execution. Our agent wasn't handling this scenario and as a result some tests were failing.

Our agent now instructs Chrome to resume execution as soon as it encounters a `debugger;` statement so tests for any pages that contain it will no longer fail.