Make sure to return a response

Added precondition to check URI_TEMPLATE is valid
This commit is contained in:
Jocelyn Fiat
2012-01-25 16:27:22 +01:00
parent e6687c7791
commit 2c4df29877
2 changed files with 5 additions and 0 deletions

View File

@@ -43,6 +43,9 @@ feature -- Execution
hdl: detachable H
do
hdl := router.dispatch_and_return_handler (req, res)
if hdl = Void then
res.put_header ({HTTP_STATUS_CODE}.not_found, <<[{HTTP_HEADER_NAMES}.header_content_length, "0"]>>)
end
end
feature {NONE} -- Routing

View File

@@ -39,6 +39,8 @@ feature -- Registration
end
map_with_uri_template_and_request_methods (uri: URI_TEMPLATE; h: H; rqst_methods: detachable ARRAY [READABLE_STRING_8])
require
uri_is_valid: uri.is_valid
local
l_tpl: like {URI_TEMPLATE}.template
l_uri: URI_TEMPLATE