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

statusCodeSuccessFilter Filter

Select exchanges whose response status code falls in the 2XX successful range, the default scope for any rule that only cares about happy path traffic.

statusCodeSuccessFilter is the concise way to scope a Fluxzy rule to happy path traffic. Combine it with response side actions such as header rewrites or HTML injection to apply changes only when the upstream actually succeeded.

When to use this filter

Use statusCodeSuccessFilter when you want a rule that applies only to successful responses. Restricting an action to the happy path is a common safety measure when the action would be inappropriate or noisy on error responses.

Typical situations:

  • Tagging or capturing only successful exchanges to keep error noise out of analytics.
  • Removing cache headers from 2XX responses to force a fresh fetch in a test environment.
  • Injecting an HTML tag into successful HTML responses while leaving 3XX and 4XX pages untouched.

The filter evaluates on the responseHeaderReceivedFromRemote scope. Use statusCodeFilter if you need to match a specific code such as 200 or 204, or pair this filter with a content type filter to narrow the scope further.

Real world examples

Tag every successful exchange

Apply a tag to any 2XX response so the happy path can be filtered in the timeline without manually selecting codes.

rules:
- filter:
    typeKind: StatusCodeSuccessFilter
  actions:
  - typeKind: ApplyTagAction
    tag:
      value: success

Strip caching headers from successful responses

Remove the Cache-Control header from 2XX responses in a test environment so the client always re fetches the resource.

rules:
- filter:
    typeKind: StatusCodeSuccessFilter
  actions:
  - typeKind: DeleteResponseHeaderAction
    headerName: Cache-Control

Inject a debugging banner into successful HTML responses

Combine the success filter with an HTML response filter inside a filterCollection so the banner only appears on real pages, not on error or redirect bodies.

rules:
- filter:
    typeKind: FilterCollection
    children:
    - typeKind: StatusCodeSuccessFilter
    - typeKind: HtmlResponseFilter
    operation: And
  actions:
  - typeKind: InjectHtmlTagAction
    tag: '<div style="position:fixed;top:0;left:0;background:#ffeb3b;padding:4px;">Fluxzy debugging session</div>'

Reference

statusCodeSuccessFilter

Description

Select exchanges that HTTP status code indicates a successful request (2XX).

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

statusCodeSuccessFilter

Settings

This filter has no specific characteristic

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

Property Type Description DefaultValue
inverted boolean Negate the filter result false

Example of usage

The following examples apply a comment to the filtered exchange

Select exchanges that HTTP status code indicates a successful request (2XX).

rules:
- filter:
    typeKind: StatusCodeSuccessFilter
  actions:
  - typeKind: ApplyCommentAction
    comment: filter was applied

.NET reference

View definition of StatusCodeSuccessFilter for .NET integration.

See also

The following filters are related to this filter:

Frequently asked questions

Which codes does it cover?

Every status code in the 200 to 299 range, including 200, 201, 204 and 206 plus any non standard 2XX returned by an intermediary.

How is it different from statusCodeFilter?

statusCodeFilter requires an explicit list of codes. statusCodeSuccessFilter is a class shortcut that always covers the whole 2XX range.

Does it match 204 No Content?

Yes. 204 is part of the 2XX class, so the filter matches even when the response carries no body.

Can I exclude 2XX responses from another rule?

Yes, set inverted: true. The rule then matches every response that is not in the 2XX range.

Learn more about Fluxzy rules