Sha256: 729c817988dafc90176ce059171f299fea2ce6907e65c7d5f24171bf42bf5c82
Contents?: true
Size: 1.13 KB
Versions: 2
Compression:
Stored size: 1.13 KB
Contents
# frozen_string_literal: true require 'rack' require 'rack/response' # All(?) Rack code is namespaced within this module. module Rack # Module includes our middleware components for managing service API versions. module ServiceApiVersioning # Middlware to query and encode data on a named service, making it available # to later entries in the middleware chain via an environment variable. class ServiceComponentDescriber # Builds Rack::Result to halt request execution, responding with a 404. class ReportServiceNotFound def self.call(service_name) new(service_name).call end def call new_response.finish end protected def initialize(service_name) @service_name = service_name self end private attr_reader :service_name def body %(Service not found: "#{service_name}") end def new_response Rack::Response.new(Array(body), 404) end end # class ServiceComponentDescriber::ReportServiceNotFound end # class ServiceComponentDescriber end end
Version data entries
2 entries across 2 versions & 1 rubygems