예제 #1
0
        public static UnicornResponse CreateOK(string body)
        {
            var unicornResponse = new UnicornResponse {
                StatusCode = 200, StatusMessage = "OK"
            };

            unicornResponse.Body.Add(body);
            return(unicornResponse);
        }
예제 #2
0
        private static UnicornResponse Execute(UnicornRequest request)
        {
            if (!_isAdminMode && !request.IsAuthenticated)
            {
                return(UnicornResponse.CreateUnauthorized());
            }

            if (!_handlers.ContainsKey(request.Verb))
            {
                return(UnicornResponse.CreateNotFound());
            }

            return(_handlers[request.Verb].Handle(request));
        }