Session state is one of the most common sources of flaky integration tests. When Fluxzy replays cookies for you through applySessionAction, you also need a clean way to drop that state at the right moment. clearSessionAction is the small but essential primitive that makes session aware rules safe to reuse across runs.
Use clearSessionAction when you want the next request to start without any session state that an earlier captureSessionAction or applySessionAction left behind. It is the easiest way to guarantee that two test runs do not contaminate each other.
Typical situations include:
The action runs on the requestHeaderReceivedFromClient scope. Without a domain value it clears every captured session for every host. Set domain when you only want to forget one upstream.
Useful in a test rig that wants to make sure no cookie or token from a previous run leaks into the current request.
rules:
- filter:
typeKind: PathFilter
pattern: /login
actions:
- typeKind: ClearSessionAction
Keep cached sessions for other domains while resetting the one you are actively testing.
rules:
- filter:
typeKind: HostFilter
pattern: api.internal.example.com
actions:
- typeKind: ClearSessionAction
domain: api.internal.example.com
Some flows reuse the same path with different methods. Tying the clear to a POST keeps the GET hot path untouched.
rules:
- filter:
typeKind: FilterCollection
operation: And
children:
- typeKind: HostFilter
pattern: payments.example.com
- typeKind: MethodFilter
methods:
- POST
actions:
- typeKind: ClearSessionAction
domain: payments.example.com
Clear stored session data for a specific domain or all domains.
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
clearSessionAction
This action has no specific characteristic
The following examples apply this action to any exchanges
Clear all stored sessions.
rules:
- filter:
typeKind: AnyFilter
actions:
- typeKind: ClearSessionAction
Clear session for a specific domain.
rules:
- filter:
typeKind: AnyFilter
actions:
- typeKind: ClearSessionAction
domain: example.com
View definition of ClearSessionAction for .NET integration.
The following actions are related to this action:
No. It only clears the session state Fluxzy stores in memory. The client browser or HTTP library keeps its own cookie jar untouched.
clearSessionAction wipes the session data Fluxzy itself replays through applySessionAction. removeResponseCookieAction edits a Set-Cookie header on the wire so the client never stores the cookie.
Yes. Either omit the domain property to clear everything, or chain multiple ClearSessionAction entries inside the same rule, each with its own domain.
As soon as the request header is parsed, before any session replay runs. That means a clear on the same exchange as an applySessionAction will leave the request without cookies.