Sha256: 2a4a3a57a094ff4178868a3ff82faa469ee657cea9c588c9ecf136271cf8babf

Contents?: true

Size: 614 Bytes

Versions: 6

Compression:

Stored size: 614 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

6 entries across 6 versions & 3 rubygems

Version Path
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/rack-accept-0.4.5/lib/rack/accept/response.rb
grape-extra_validators-1.0.0 vendor/bundle/ruby/2.4.0/gems/rack-accept-0.4.5/lib/rack/accept/response.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/rack-accept-0.4.5/lib/rack/accept/response.rb
rack-accept-0.4.5 lib/rack/accept/response.rb
rack-accept-0.4.4 lib/rack/accept/response.rb
rack-accept-0.4.3 lib/rack/accept/response.rb