Sha256: 1dd125b0d205099976847d033c08db98b4767881147e7b5622cffe3ebaa725dc

Contents?: true

Size: 534 Bytes

Versions: 3

Compression:

Stored size: 534 Bytes

Contents

# frozen_string_literal: true

module Acfs
  module Middleware
    # A base middleware that does not modify request or response.
    # Can be used as super class for custom middleware implementations.
    #
    class Base
      attr_reader :app, :options

      def initialize(app, **opts)
        @app     = app
        @options = opts
      end

      def call(request)
        if respond_to? :response
          request.on_complete {|res, nxt| response(res, nxt) }
        end
        app.call(request)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
acfs-2.0.0 lib/acfs/middleware/base.rb
acfs-1.7.0 lib/acfs/middleware/base.rb
acfs-1.6.0 lib/acfs/middleware/base.rb