Sha256: 2544bb280e5c0c3fd6e279fa498fcaf3385f56b6fd05df00c1156997713818ed

Contents?: true

Size: 356 Bytes

Versions: 4

Compression:

Stored size: 356 Bytes

Contents

# frozen_string_literal: true

module ApiProxy
  class Middleware
    def initialize(app, namespace = :default)
      @app = app
      @namespace = namespace
    end

    def call(env)
      builder = ApiProxy::ResponseBuilder.new(env, @namespace)

      return @app.call(env) unless builder.allow_request?

      builder.response.finish
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
api_proxy-0.2.9 lib/api_proxy/middleware.rb
api_proxy-0.2.8 lib/api_proxy/middleware.rb
api_proxy-0.2.7 lib/api_proxy/middleware.rb
api_proxy-0.2.6 lib/api_proxy/middleware.rb