Sha256: b53d6a403ef0a350dc5ee2814f8439408696eedbc3ebf76bc998a2d0e457fd56
Contents?: true
Size: 595 Bytes
Versions: 1
Compression:
Stored size: 595 Bytes
Contents
require 'uri' require 'net/http' require 'ustyle/utils' module Reustyle class IconMiddleware def initialize(app, options = {}) @app = app @icon_path = options[:path] || Reustyle.cloudfront_url("icons.svg", :icon, false, false) end def call(env) request = Rack::Request.new(env) if request.path == "/icons.svg" [200, {"Content-Type" => "image/svg+xml"}, [serve_icons.to_s]] else @app.call(env) end end def serve_icons uri = URI(@icon_path) res = Net::HTTP.get_response(uri) res.body end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
reustyle-2.0.10 | lib/ustyle/middleware/icon_middleware.rb |