Beispiel #1
0
        public static IResponse NotFoundResponse()
        {
            var headers = new Dictionary<string, IEnumerable<string>>()
            {
                { "Content-Type", new string[] { "text/html" } }
            };

            var body = "<h1>Not Found</h1><p>The requested resource was not found.";
            headers.SetContentLength(body.Length);

            return new KayakResponse("404 Not Found", headers, body);
        }
Beispiel #2
0
        public static IResponse InvalidMethodResponse(string verb)
        {
            var headers = new Dictionary<string, IEnumerable<string>>()
            {
                { "Content-Type", new string[] { "text/html" } }
            };

            var body = "<h1>Invalid method</h1><p>The requested resource does not support the method '" + verb + "'.";
            headers.SetContentLength(body.Length);

            return new KayakResponse("405 Invalid Method", headers, body);
        }