Example

Method Override

Demonstrates how to enable the built-in Helix method-override filter. Shows a client sending POST with X-HTTP-Method-Override: DELETE so Helix routes the request to a delete endpoint.
Group
REST API
Path
examples/rest-api/method-override

Overview

Helix Spring Boot webservice that shows how to enable the built-in method-override filter so a client can send POST

while asking Helix to treat the request as a different HTTP method.

Run this example from the shared examples build:

Run

Run this example from the shared examples build


./gradlew -p examples runExample -Pexample=rest-api/method-override --init-script "$(pwd)/helix.init.gradle"

What It Shows

  • the Helix API starter baseline
  • the standard Helix response envelope
  • request identifier handling via X-Request-ID
  • enabling the built-in method-override filter with helix.filter.methodoverride.enabled=true
  • using X-HTTP-Method-Override so a POST request can be treated as DELETE
  • the difference between an overridden request and a plain POST that does not match the DELETE route

Endpoints

  • DELETE /v1/method-override/subscriptions/{name}
  • GET /liveness
  • GET /health

Example success response

{
  "request_id": "generated-by-helix",
  "status": "SUCCESS",
  "timestamp": "2026-03-15T12:34:56+0000",
  "data": {
    "name": "legacy-mobile-client",
    "action": "cancelled",
    "effectiveMethod": "DELETE"
  }
}

Example error response

{
  "request_id": "generated-by-helix",
  "status": "FAILED",
  "timestamp": "2026-03-15T12:34:56+0000",
  "data": {
    "status": 500,
    "message": "Method 'POST' is not supported."
  }
}

Development

Building the Application

Run the following command to build the service:

Command

Building the Application


./gradlew clean build

Testing the Application

Run the following command to run the service tests:

Command

Testing the Application


./gradlew test
./gradlew integration

Trying the API

Run the service:

Then try:

The first request shows Helix rewriting the incoming POST to DELETE before Spring MVC matches the handler. The second request omits the override header, so the request remains a POST and Helix returns its standard failed error envelope for the unsupported method.

Command

Trying the API


./gradlew bootRun

Command

Trying the API


curl -i -X POST \
  -H 'X-HTTP-Method-Override: DELETE' \
  http://localhost:8080/v1/method-override/subscriptions/legacy-mobile-client

curl -i -X POST \
  http://localhost:8080/v1/method-override/subscriptions/legacy-mobile-client