Sha256: f27d3ea4d3098dc2b9ef5bcc7882c367bd4f28c572f910636bf232f7aaf12f2f
Contents?: true
Size: 802 Bytes
Versions: 8
Compression:
Stored size: 802 Bytes
Contents
require 'rack/request' module Useless module Doc class Proxy # +Doc::Proxy::URL+ translates the request URL into the corresponding # API URL using the specified 'useless.doc.router'. # class URL def initialize(app) @app = app end def call(env) request = ::Rack::Request.new(env) if url = env['useless.doc.router'].api_for_doc(request.url) env['useless.doc.url'] = url if env['useless.doc.logger'] env['useless.doc.logger'].info "routing #{request.url} to #{env['useless.doc.url']}" end @app.call(env) else [404, {'Content-Type' => 'text/plain'}, ['Unknown documentation.']] end end end end end end
Version data entries
8 entries across 8 versions & 1 rubygems