Added WSF_DEFAULT_*_RESPONSE

Fixed the method not allowed by setting the Allow: header
This commit is contained in:
Jocelyn Fiat
2012-12-14 15:52:35 +01:00
parent 8e31950285
commit cc570f5abf
4 changed files with 124 additions and 15 deletions

View File

@@ -48,22 +48,9 @@ feature -- Execution
execute_default (req: WSF_REQUEST; res: WSF_RESPONSE)
-- Default procedure
local
msg: WSF_RESPONSE_MESSAGE
not_found: WSF_NOT_FOUND_RESPONSE
not_allowed: WSF_METHOD_NOT_ALLOWED_RESPONSE
trace: WSF_TRACE_RESPONSE
msg: WSF_DEFAULT_ROUTER_RESPONSE
do
if req.is_request_method ({HTTP_REQUEST_METHODS}.method_trace) then
create trace.make (req)
msg := trace
elseif attached router.allowed_methods_for_request (req) as mtds and then not mtds.is_empty then
create not_allowed.make (req)
not_allowed.set_suggested_methods (mtds)
msg := not_allowed
else
create not_found.make (req)
msg := not_found
end
create msg.make_with_router (req, router)
res.send (msg)
end