class Amber::Pipe::ApiVersion

Overview

Middleware that extracts an API version from request headers and normalizes it into a standard internal header for downstream use.

Usage in pipeline configuration: Amber::Server.instance.pipeline :api do plug Amber::Pipe::ApiVersion.new(default_version: "v1") end

Controllers can then access the version: request.headers["X-Api-Version"]?

Defined in:

amber/pipes/api_version.cr

Constructors

Instance Method Summary

Instance methods inherited from class Amber::Pipe::Base

call(context : HTTP::Server::Context) call

Constructor Detail

def self.new(header : String = "Api-Version", default_version : String | Nil = nil) #

[View source]

Instance Method Detail

def call(context : HTTP::Server::Context) #
Description copied from class Amber::Pipe::Base

Execution of this handler.


[View source]