Sha256: 23b61f23129bae7b1dd9a7abd0b7284c42b82a75021c5402ef72d498fe803391

Contents?: true

Size: 617 Bytes

Versions: 3

Compression:

Stored size: 617 Bytes

Contents

require 'rack/response'

module Rack::Accept

  # The base class for responses issued by Rack::Accept.
  class Response < Rack::Response

    # Marks this response as being unacceptable and clears the response body.
    #
    # Note: The HTTP spec advises servers to respond with an "entity" that
    # describes acceptable parameters, but it fails to go into detail about its
    # implementation. Thus, it is up to the user of this library to create such
    # an entity if one is desired.
    def not_acceptable!
      self.status = 406
      self.body = []
      header['Content-Length'] = '0'
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rack-accept-0.4.2 lib/rack/accept/response.rb
rack-accept-0.4.1 lib/rack/accept/response.rb
rack-accept-0.3 lib/rack/accept/response.rb