Added some checks for custom erros being set.

This commit is contained in:
Colin Adams
2013-08-12 16:45:47 +01:00
parent 2ed362f5d3
commit b074570e99
2 changed files with 44 additions and 33 deletions

View File

@@ -23,11 +23,17 @@ feature {NONE} -- Implementation
-- "NEGOTIATED_ENCODING" -- "NEGOTIATED_ENCODING"
local local
l_dt: STRING l_dt: STRING
l_ok: BOOLEAN
do do
a_handler.delete (req) a_handler.delete (req)
l_ok := a_handler.response_ok (req)
if l_ok then
if a_handler.includes_response_entity (req) then if a_handler.includes_response_entity (req) then
a_handler.ensure_content_available (req) a_handler.ensure_content_available (req)
l_ok := a_handler.response_ok (req)
if l_ok then
a_header.put_content_length (a_handler.content_length (req).as_integer_32) a_header.put_content_length (a_handler.content_length (req).as_integer_32)
end
-- we don't bother supporting chunked responses for DELETE. -- we don't bother supporting chunked responses for DELETE.
else else
a_header.put_content_length (0) a_header.put_content_length (0)
@@ -50,7 +56,9 @@ feature {NONE} -- Implementation
res.set_status_code ({HTTP_STATUS_CODE}.no_content) res.set_status_code ({HTTP_STATUS_CODE}.no_content)
res.put_header_text (a_header.string) res.put_header_text (a_header.string)
end end
else end
end
if not l_ok then
write_error_response (req, res) write_error_response (req, res)
end end
end end

View File

@@ -26,6 +26,8 @@ feature {NONE} -- Implementation
l_dt: STRING l_dt: STRING
do do
a_handler.ensure_content_available (req) a_handler.ensure_content_available (req)
l_ok := a_handler.response_ok (req)
if l_ok then
l_chunked := a_handler.is_chunking (req) l_chunked := a_handler.is_chunking (req)
if l_chunked then if l_chunked then
a_header.put_transfer_encoding_chunked a_header.put_transfer_encoding_chunked
@@ -38,6 +40,7 @@ feature {NONE} -- Implementation
generate_cache_headers (req, a_handler, a_header, l_time) generate_cache_headers (req, a_handler, a_header, l_time)
end end
l_ok := a_handler.response_ok (req) l_ok := a_handler.response_ok (req)
end
if l_ok then if l_ok then
res.set_status_code ({HTTP_STATUS_CODE}.ok) res.set_status_code ({HTTP_STATUS_CODE}.ok)
else else