1 /*
2  * Archttp - A highly performant web framework written in D.
3  *
4  * Copyright (C) 2021-2022 Kerisy.com
5  *
6  * Website: https://www.kerisy.com
7  *
8  * Licensed under the Apache-2.0 License.
9  *
10  */
11 
12 module archttp.HttpMethod;
13 
14 /*
15  * HTTP method enum
16  */
17 enum HttpMethod : ushort {
18     GET,
19     POST,
20     HEAD,
21     PUT,
22     DELETE,
23     OPTIONS,
24     TRACE,
25     CONNECT,
26     BREW,
27     PATCH
28 }
29 
30 HttpMethod getHttpMethodFromString(string method)
31 {
32     switch (method)
33     {
34         case "GET":
35             return HttpMethod.GET;
36         case "POST":
37             return HttpMethod.POST;
38         case "HEAD":
39             return HttpMethod.HEAD;
40         case "PUT":
41             return HttpMethod.PUT;
42         case "DELETE":
43             return HttpMethod.DELETE;
44         case "OPTIONS":
45             return HttpMethod.OPTIONS;
46         case "TRACE":
47             return HttpMethod.TRACE;
48         case "CONNECT":
49             return HttpMethod.CONNECT;
50         case "BREW":
51             return HttpMethod.BREW;
52         case "PATCH":
53             return HttpMethod.PATCH;
54         default:
55             return HttpMethod.GET; // show error?
56     }
57 }