Method: Oaf::HTTPServer#get_request_body
- Defined in:
- lib/oaf/httpserver.rb
#get_request_body(req) ⇒ Object
Safely retrieves the request body, and assumes an empty string if it cannot be retrieved. This helps get around a nasty exception in WEBrick.
Parameters:
- req
-
A WEBrick::HTTPRequest object
Returns:
A string containing the request body
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/oaf/httpserver.rb', line 38 def get_request_body req if ['POST', 'PUT'].member? req.request_method begin result = req.body rescue WEBrick::HTTPStatus::LengthRequired result = '' # needs to be in rescue for coverage end end result end |