Sha256: 4089b2587c4fc80195e313dbf2522dcc48e0e85f8fbab02a49efaac924c4da01

Contents?: true

Size: 442 Bytes

Versions: 2

Compression:

Stored size: 442 Bytes

Contents

require 'sinatra'
class ApplicationController < Sinatra::Base
  def static(uri, *args)
    if env['HTTP_VERSION'] == 'HTTP/1.1' and env["REQUEST_METHOD"] != 'GET'
      status 303
    else
      status 302
    end

    # According to RFC 2616 section 14.30, "the field value consists of a
    # single absolute URI"
    response['Location'] = uri(uri.to_s, settings.absolute_redirects?, settings.prefixed_redirects?)
    halt(*args)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
eucalypt-0.5.1 lib/eucalypt/core/helpers/static.rb
eucalypt-0.5.0 lib/eucalypt/core/helpers/static.rb