Added WSF_DEFAULT_*_RESPONSE
Fixed the method not allowed by setting the Allow: header
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user