Sha256: 0048cdb02a092c58ddff07d016ca6c75d01045a9d42059e4e86a9f21968f43ad

Contents?: true

Size: 367 Bytes

Versions: 3

Compression:

Stored size: 367 Bytes

Contents

module Stoor
  class ReadOnly
    include Rack::Utils

    def initialize(app, path)
      @app, @path = app, path
    end

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

      if request.path_info =~ /\A\/(create|delete)/ || request.post? || request.put?
        return [302, { 'Location' => @path }, []]
      end

      @app.call(env)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
stoor-0.1.12 lib/stoor/read_only.rb
stoor-0.1.11 lib/stoor/read_only.rb
stoor-0.1.9 lib/stoor/read_only.rb