Example

Date Header

Demonstrates how to enable the built-in Helix Date header filter. Shows Helix automatically adding the Date header and leaving an endpoint-specific override in place.
Group
REST API
Path
examples/rest-api/date-header

Overview

Helix Spring Boot webservice that shows how to enable the built-in Date header filter and how an endpoint can override

the header value explicitly.

Run this example from the shared examples build:

Run

Run this example from the shared examples build


./gradlew -p examples runExample -Pexample=rest-api/date-header --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 date-header filter with helix.filter.date.enabled=true
  • Helix automatically adding a Date header when an endpoint does not set one
  • overriding the automatic Date header for a specific endpoint by returning an explicit header

Endpoints

  • GET /v1/date-header/default
  • GET /v1/date-header/custom
  • GET /liveness
  • GET /health

Example success response

{
  "request_id": "generated-by-helix",
  "status": "SUCCESS",
  "timestamp": "2026-03-15T12:34:56+0000",
  "data": {
    "name": "default-date-header",
    "message": "This response relies on Helix to add the Date header."
  }
}

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 endpoint shows Helix adding the Date header automatically. The second endpoint sets a fixed Date header value itself through the servlet response, so the Helix filter leaves that explicit value in place.

Command

Trying the API


./gradlew bootRun

Command

Trying the API


curl -i http://localhost:8080/v1/date-header/default

curl -i http://localhost:8080/v1/date-header/custom