originAgentCluster function

Middleware originAgentCluster()

Sets the Origin-Agent-Cluster header, which provides a mechanism to allow web applications to isolate their origins. Read more about it in the spec.

Examples:

import 'package:shelf_helmet/shelf_helmet.dart'
// Sets "Origin-Agent-Cluster: ?1"
.addMiddleware(originAgentCluster())

Implementation

Middleware originAgentCluster() {
  return (innerHandler) {
    return (request) async {
      final response = await innerHandler(request);
      return response.change(
        headers: {'origin-agent-cluster': '?1', ...response.headersAll},
      );
    };
  };
}