module Sidekiq::WebRouter

def delete(path, &block)

def delete(path, &block)
  route(DELETE, path, &block)
end

def get(path, &block)

def get(path, &block)
  route(GET, path, &block)
end

def head(path, &block)

def head(path, &block)
  route(HEAD, path, &block)
end

def match(env)

def match(env)
  request_method = env[REQUEST_METHOD]
  path_info = ::Rack::Utils.unescape env[PATH_INFO]
  # There are servers which send an empty string when requesting the root.
  # These servers should be ashamed of themselves.
  path_info = "/" if path_info == ""
  @routes[request_method].each do |route|
    params = route.match(request_method, path_info)
    if params
      env[ROUTE_PARAMS] = params
      return WebAction.new(env, route.block)
    end
  end
  nil
end

def patch(path, &block)

def patch(path, &block)
  route(PATCH, path, &block)
end

def post(path, &block)

def post(path, &block)
  route(POST, path, &block)
end

def put(path, &block)

def put(path, &block)
  route(PUT, path, &block)
end

def route(method, path, &block)

def route(method, path, &block)
  @routes ||= {GET => [], POST => [], PUT => [], PATCH => [], DELETE => [], HEAD => []}
  @routes[method] << WebRoute.new(method, path, block)
end