New Transparent capture is in preview. Record every app's traffic with no proxy configuration, on Windows, macOS and Linux. Learn more

delayAction Action

Inject a fixed latency at a chosen point of the exchange to reproduce slow upstreams, race conditions, and timeout bugs.

Latency is one of the few production conditions that is hard to fake well in unit tests. delayAction gives you a deterministic way to drop slowness into any exchange and watch the client react. Combine it with filters to narrow the impact to one endpoint, or with averageThrottleAction to model both startup delay and throughput.

When to use this action

Reach for delayAction when you need to reproduce a slow network or a slow upstream without leaving your laptop. It is the lightest way to verify that a client correctly handles latency, retries, or timeouts.

Typical situations include:

  • Confirming that an HTTP client times out at the expected threshold.
  • Reproducing a race condition that only shows up when the response is late.
  • Stress testing UI loading states with a realistic delay budget.
  • Comparing two clients under the same artificial latency profile.

The scope property controls when the delay fires. Use onAuthorityReceived to slow connection setup, responseHeaderReceivedFromRemote (the default) to slow the response, or responseBodyReceivedFromRemote to slow the body. Durations are in milliseconds.

Real world examples

Add 2 seconds of latency to a specific API

Verifies that the calling client gracefully degrades when the upstream is slow but still functional.

rules:
- filter:
    typeKind: HostFilter
    pattern: api.internal.example.com
  actions:
  - typeKind: DelayAction
    duration: 2000

Slow only the response body, not the headers

Helps reproduce bugs where a client reads the status code quickly but stalls while streaming the body.

rules:
- filter:
    typeKind: PathFilter
    pattern: /download
  actions:
  - typeKind: DelayAction
    duration: 5000
    scope: ResponseBodyReceivedFromRemote

Delay TLS setup to test connection timeouts

Triggers the delay as soon as Fluxzy knows the destination authority, before the TCP connection completes.

rules:
- filter:
    typeKind: HostFilter
    pattern: payments.example.com
  actions:
  - typeKind: DelayAction
    duration: 10000
    scope: OnAuthorityReceived

Reference

delayAction

Description

Add a latency to the exchange.

Evaluation scope

Evaluation scope defines the timing where this filter will be applied.

responseHeaderReceivedFromRemote This scope occurs the moment fluxzy has done parsing the response header.

YAML configuration name

delayAction

Settings

The following table describes the customizable properties available for this action:

Property Type Description DefaultValue
duration int32 Duration in milliseconds 0
scope onAuthorityReceived | requestHeaderReceivedFromClient | dnsSolveDone | requestBodyReceivedFromClient | responseHeaderReceivedFromRemote | responseBodyReceivedFromRemote | copySibling | outOfScope Define when the delay is applied responseHeaderReceivedFromRemote

Example of usage

This filter has no specific usage example

.NET reference

View definition of DelayAction for .NET integration.

See also

This action has no related action

Frequently asked questions

What unit is the duration in?

Milliseconds. A value of 1500 means a 1.5 second delay.

Can I randomise the delay?

Not directly. delayAction takes a fixed value. For random or distribution based latency, generate the rules from a script or use setVariableAction together with several delay rules.

Does the delay affect both request and response timing?

Only at the scope you choose. The default scope delays after response headers arrive, which simulates a slow server. Pick a request side scope to simulate a slow client or slow network upload.

Is there a way to throttle throughput instead of just adding a fixed wait?

Yes, use averageThrottleAction to cap the bytes per second. Combine it with delayAction when you need both a fixed startup latency and a sustained throughput limit.

Learn more about Fluxzy rules