Class: Rack::Accept::Response

Inherits:
Response
  • Object
show all
Defined in:
lib/rack/accept/response.rb

Overview

The base class for responses issued by Rack::Accept.

Instance Method Summary collapse

Instance Method Details

#not_acceptable! ⇒ Object

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.



12
13
14
15
16
# File 'lib/rack/accept/response.rb', line 12

def not_acceptable!
  self.status = 406
  self.body = []
  header['Content-Length'] = '0'
end