When we get a no content response as 204, it comes with a message "No Content" and displays a response
Response : #<Net::HTTPNoContent 204 No Content readbody=true>
while i want the response like :
<response>
<request_id>4ccf18f0-e83d-012e-29f7-042b2b8686e6</request_id>
<status_code>204</status_code>
<message>No Offers were found</message>
</response>
Can i override the default message of 204 error.The method which is being called to create the response.
def generate_success_response_without_data(format, request_id, message)
status_code = 204
format_type_method, options_hash, content_type = get_format_method(format)
data = {
"request_id" => request_id,
"status_code" => status_code,
"message" => message
}
data = generate_data_format(format, data)
resp = [status_code, {"Content-Type" => content_type}, data.send(format_type_method, options_hash)]
# Convert rack response to action controller response
generate_active_controller_response_format(resp)
resp
end
EDIT: As stated in http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html
The 204 response MUST NOT include a message-body, and thus is always terminated by the first empty line after the header fields.
Can we hack somehow and show a message body