Skip to content

Create an error response body outside render_error (issue #144) #232

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/webmachine/errors.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ module Webmachine
# the response body
def self.render_error(code, req, res, options={})
res.code = code
# The response cannot be encoded in render_error so the Content-Encoding
# header is removed here.
res.headers.delete CONTENT_ENCODING
unless res.body
title, message = t(["errors.#{code}.title", "errors.#{code}.message"],
{ :method => req.method,
Expand Down