Sha256: 9103165edcbb14112c6c0b619e54e6b5f5ad6568fcddc60820b0da87f146d3d7

Contents?: true

Size: 432 Bytes

Versions: 10

Compression:

Stored size: 432 Bytes

Contents

module Rack
  class API
    module Middleware
      class SSL
        def initialize(app)
          @app = app
        end

        def call(env)
          request = Rack::Request.new(env)

          if env["rack.url_scheme"] == "https"
            @app.call(env)
          else
            [400, {"Content-Type" => "text/plain"}, ["Only HTTPS requests are supported by now."]]
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rack-api-1.1.0 lib/rack/api/middleware/ssl.rb
rack-api-1.0.2 lib/rack/api/middleware/ssl.rb
rack-api-1.0.1 lib/rack/api/middleware/ssl.rb
rack-api-1.0.0 lib/rack/api/middleware/ssl.rb
rack-api-0.3.1 lib/rack/api/middleware/ssl.rb
rack-api-0.3.0 lib/rack/api/middleware/ssl.rb
rack-api-0.2.2 lib/rack/api/middleware/ssl.rb
rack-api-0.2.1 lib/rack/api/middleware/ssl.rb
rack-api-0.2.0 lib/rack/api/middleware/ssl.rb
rack-api-0.1.2 lib/rack/api/middleware/ssl.rb