Share this page

# TCA.addNetworkFilter

Adds a filter for URL requests.

    TCA.addNetworkFilter(filters, include, applyTo);

Note:
- This function is only relevant for steps that have a network-related end event, or that do not have any end event.
- You cannot use exclude and include filters at the same time.

## Arguments

Name | Description
--- | ---
filters | (string or RegExp) Filter representing one or more URLs. Separate multiple URLs with a semicolon (;). The URL can include a wildcard (*) which can match 0 or more characters.
include (Optional) | (boolean) Set to true to include URL requests that match the filter; otherwise false (default value).
applyTo (Optional) | Specify the type of request the filter applies to. Possible values: Xhr. Filters XHR requests only. NonXhr. Filters non-XHR requests only. All. Filters all requests (default value).

## Return value

A promise that will be fulfilled with no arguments.

## Example

From the point that you add this API call, until you call the remove filter or the end of the iteration, TruClient will not wait for requests to get a response unless the URL has a `http://www.myco.com/` prefix.

Copy code

    TCA.addNetworkFilter("http://www.myco.com/*", true, "All").then(function(){
      TCA.done();
    }).catch(function (error) {
      TCA.doneWithError(error);
    });

Tips to improve your search results... VuGen Function Reference Version 26.1 Function Reference 26.1 All View Local Help Center View Online Help Center Version: