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

            unicornResponse.Body.Add(body);
            return(unicornResponse);
        }
        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));
        }