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

formRequestFilter Filter

Select requests carrying form data, either multipart/form-data or application/x-www-form-urlencoded, by inspecting the Content-Type header.

formRequestFilter is the broad form selector in Fluxzy. It is the right pick when you do not care which encoding the browser used and you just want to act on every HTML form submission that hits the proxy.

When to use this filter

Use formRequestFilter when you want to act on classic HTML form submissions. The filter matches both encodings the browser may use:

  • multipart/form-data, which is what file upload forms use.
  • application/x-www-form-urlencoded, which is what plain text forms use by default.

Typical situations:

  • Throttling a file upload endpoint to reproduce a slow link bug.
  • Stripping or rewriting a CSRF header on form submissions during integration testing.
  • Logging every form post during a regression sweep to confirm the test runner exercises the right pages.

The filter evaluates on the requestHeaderReceivedFromClient scope, so it fires before the request body is forwarded. If you specifically want urlencoded forms and need to exclude multipart, use formUrlEncodedRequestFilter instead.

Real world examples

Throttle uploads to a specific endpoint

Simulate a slow uplink for file uploads on the asset endpoint to reproduce a customer reported timeout.

rules:
- filter:
    typeKind: FilterCollection
    operation: and
    children:
    - typeKind: PathFilter
      pattern: /upload
      operation: StartsWith
    - typeKind: FormRequestFilter
  actions:
  - typeKind: AverageThrottleAction
    bandwidthBytesPerSeconds: 32000

Tag form submissions for audit

Tag every form submission in the capture so the post run report can confirm which forms were exercised by the test suite.

rules:
- filter:
    typeKind: FormRequestFilter
  actions:
  - typeKind: ApplyTagAction
    tag:
      value: form-submission

Mock the response of a contact form during development

Return a canned success response for any form submission to the contact endpoint while the backend mailer is being rewritten.

rules:
- filter:
    typeKind: FilterCollection
    operation: and
    children:
    - typeKind: PathFilter
      pattern: /contact
      operation: Exact
    - typeKind: FormRequestFilter
  actions:
  - typeKind: MockedResponseAction
    response:
      statusCode: 200
      body:
        type: fromString
        text: '{"sent":true}'
        contentType: application/json

Reference

formRequestFilter

Description

Select request sending 'multipart/form-data' or 'application/x-www-form-urlencoded' body. Filtering is made by inspecting value of Content-Type header

Evaluation scope

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

requestHeaderReceivedFromClient This scope occurs the moment fluxzy parsed the request header receiveid from client

YAML configuration name

formRequestFilter

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

Retains exchanges having POST as method OR request to the host example.com.

rules:
- filter:
    typeKind: FilterCollection
    children:
    - typeKind: PostFilter
    - typeKind: HostFilter
      pattern: example.com
      operation: Exact
  actions:
  - typeKind: ApplyCommentAction
    comment: filter was applied

.NET reference

View definition of FormRequestFilter for .NET integration.

See also

This filter has no related filter

Frequently asked questions

What is the difference with formUrlEncodedRequestFilter?

formRequestFilter matches both multipart and urlencoded forms. formUrlEncodedRequestFilter only matches application/x-www-form-urlencoded.

Does it inspect the request body?

No. The match is performed on the Content-Type request header. Fluxzy does not parse the body to make this decision.

Does it handle non standard form encodings?

No. Custom or vendor specific content types are not matched. Use a requestHeaderFilter with a Content-Type pattern if you need to cover them.

Can I combine it with method filters?

Yes. Wrap it in a filterCollection with a postFilter or putFilter when you also need to constrain the method.

Learn more about Fluxzy rules