Sha256: 3c167c1b8887c2c81dc13d354c129fd23e98abe81931ab78070a2b8e15baf66f

Contents?: true

Size: 444 Bytes

Versions: 23

Compression:

Stored size: 444 Bytes

Contents

require 'faraday'



module Saddle
  module Middleware
    module Request

      # Public: Adds a prefix to the relative url path if present

      class PathPrefix < Faraday::Middleware
        def call(env)
          if env[:request][:client_options][:path_prefix]
            env[:url].path = "/#{env[:request][:client_options][:path_prefix]}#{env[:url].path}"
          end

          @app.call env
        end
      end

    end
  end
end

Version data entries

23 entries across 23 versions & 1 rubygems

Version Path
saddle-0.0.53 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.51 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.50 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.49 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.48 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.46 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.45 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.44 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.43 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.42 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.41 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.38 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.37 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.36 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.35 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.34 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.33 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.32 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.31 lib/saddle/middleware/request/path_prefix.rb
saddle-0.0.30 lib/saddle/middleware/request/path_prefix.rb