Sometimes the client and the server cannot agree on a verb. A new API expects PATCH, but the SDK only ships with POST. A debugging tool wants to exercise DELETE without you writing a wrapper script. changeRequestMethodAction rewrites the method between the two so the rest of your stack keeps working unchanged.
Use changeRequestMethodAction when you need to rewrite the verb of a request before it reaches the upstream server. The body and headers are kept, only the method changes.
Typical situations include:
The action evaluates on requestHeaderReceivedFromClient, so it runs early in the pipeline. Combine with methodFilter and pathFilter to scope the rewrite tightly.
Useful for a client that only supports POST while the API expects partial updates over PATCH.
rules:
- filter:
typeKind: FilterCollection
operation: And
children:
- typeKind: HostFilter
pattern: api.example.com
- typeKind: PathFilter
pattern: /v1/users/
- typeKind: PostFilter
actions:
- typeKind: ChangeRequestMethodAction
newMethod: PATCH
Some servers misbehave when an idempotent verb is replaced with a destructive one. Combine with a strict host filter to keep the experiment safe.
rules:
- filter:
typeKind: FilterCollection
operation: And
children:
- typeKind: HostFilter
pattern: staging.api.example.com
- typeKind: PathFilter
pattern: ^/v1/items/
operation: Regex
- typeKind: GetFilter
actions:
- typeKind: ChangeRequestMethodAction
newMethod: DELETE
Some servers care about Content-Type when promoting GET to POST. Add a header in the same rule so the request is acceptable to the upstream.
rules:
- filter:
typeKind: PathFilter
pattern: /v1/search
actions:
- typeKind: ChangeRequestMethodAction
newMethod: POST
- typeKind: AddRequestHeaderAction
headerName: Content-Type
headerValue: application/json
Alter the method of an exchange.
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
changeRequestMethodAction
The following table describes the customizable properties available for this action:
| Property | Type | Description | DefaultValue |
|---|---|---|---|
| newMethod | string |
The following examples apply this action to any exchanges
Change request method PATCH.
rules:
- filter:
typeKind: AnyFilter
actions:
- typeKind: ChangeRequestMethodAction
newMethod: PATCH
View definition of ChangeRequestMethodAction for .NET integration.
The following actions are related to this action:
No. The body, headers, and path are untouched. If the new verb expects a body and the old one did not have one, you need to add it with another action or accept that the upstream will reject the request.
Yes. Fluxzy updates the :method pseudo header consistently so the change works across HTTP/1.1, HTTP/2, and HTTP/3.
Yes. The action does not validate the verb. Servers will reject unknown methods, but if you control the upstream you can use anything that parses as an HTTP token.
The action only rewrites the request method. Responses are not affected by this rule.