module Roda::RodaPlugins::InvalidRequestBody::RequestMethods
def POST
raises an exception.
Handle invalid request bodies as configured if the default behavior
def POST super rescue => e handle_invalid_request_body(e) end
def handle_invalid_request_body_empty_400(e)
Return an empty 400 HTTP response for invalid request bodies.
def handle_invalid_request_body_empty_400(e) response.status = 400 headers = response.headers headers.clear headers[RodaResponseHeaders::CONTENT_TYPE] = 'text/html' headers[RodaResponseHeaders::CONTENT_LENGTH] ='0' throw :halt, response.finish_with_body([]) end
def handle_invalid_request_body_empty_hash(e)
POST params.
Treat invalid request bodies by using an empty hash as the
def handle_invalid_request_body_empty_hash(e) {} end
def handle_invalid_request_body_raise(e)
to allow for easy rescuing using the error_handler plugin.
Raise a specific error for all invalid request bodies,
def handle_invalid_request_body_raise(e) raise Error, e.message end