class Saddle::Middleware::Request::PathPrefix

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

Public Instance Methods

call(env) click to toggle source
# File lib/saddle/middleware/request/path_prefix.rb, line 12
def call(env)
  if env[:saddle][:client_options][:path_prefix]
    env[:url].path = "/#{env[:saddle][:client_options][:path_prefix]}#{env[:url].path}"
  end

  @app.call env
end