module Sidekiq::WebRouter
Constants
- DELETE
- GET
- HEAD
- PATCH
- PATH_INFO
- POST
- PUT
- REQUEST_METHOD
- ROUTE_PARAMS
Public Instance Methods
delete(path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 38 def delete(path, &block) route(DELETE, path, &block) end
get(path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 22 def get(path, &block) route(GET, path, &block) end
head(path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 18 def head(path, &block) route(HEAD, path, &block) end
match(env)
click to toggle source
# File lib/sidekiq/web/router.rb, line 48 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
patch(path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 34 def patch(path, &block) route(PATCH, path, &block) end
post(path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 26 def post(path, &block) route(POST, path, &block) end
put(path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 30 def put(path, &block) route(PUT, path, &block) end
route(method, path, &block)
click to toggle source
# File lib/sidekiq/web/router.rb, line 42 def route(method, path, &block) @routes ||= {GET => [], POST => [], PUT => [], PATCH => [], DELETE => [], HEAD => []} @routes[method] << WebRoute.new(method, path, block) end