strip-fetch-query-parameter

The strip-fetch-query-parameter strips a query string parameter from fetch() calls.

You can use this snippet to remove parameters from fetch calls that mach a urlPattern, if provided. If urlPattern isn't provided, the parameter gets stripped from all fetch calls.

Parameters

NameDescriptionMandatory

name

The parameter's name.

Yes

urlPattern

An optional pattern that the URL must match. If the string begins and ends with a slash (/), the text in between is treated as a regular expression.

No

Filter examples

The following table lists examples that use the strip-fetch-query-parameter snippet:

FilterResult

strip-fetch-query-parameter ads

Strips the ads param from all fetch calls.

strip-fetch-query-parameter ads someadsserver.com/get-ads

Strips the ads param from fetch calls whose source matches the someadsserver.com/get-ads pattern.

Last updated