1
+ // HTTPMethod+Luminescence.swift
2
+ //
3
+ // The MIT License (MIT)
4
+ //
5
+ // Copyright (c) 2015 Zewo
6
+ //
7
+ // Permission is hereby granted, free of charge, to any person obtaining a copy
8
+ // of this software and associated documentation files (the "Software"), to deal
9
+ // in the Software without restriction, including without limitation the rights
10
+ // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ // copies of the Software, and to permit persons to whom the Software is
12
+ // furnished to do so, subject to the following conditions:
13
+ //
14
+ // The above copyright notice and this permission notice shall be included in all
15
+ // copies or substantial portions of the Software.
16
+ //
17
+ // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
+ // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
+ // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
+ // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
+ // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
+ // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
+ // SOFTWARE.
24
+
25
+ extension HTTPMethod {
26
+ init ( code: Int ) {
27
+ switch code {
28
+ case 00 : self = DELETE
29
+ case 01 : self = GET
30
+ case 02 : self = HEAD
31
+ case 03 : self = POST
32
+ case 04 : self = PUT
33
+ case 05 : self = CONNECT
34
+ case 06 : self = OPTIONS
35
+ case 07 : self = TRACE
36
+ case 08 : self = COPY
37
+ case 09 : self = LOCK
38
+ case 10 : self = MKCOL
39
+ case 11 : self = MOVE
40
+ case 12 : self = PROPFIND
41
+ case 13 : self = PROPPATCH
42
+ case 14 : self = SEARCH
43
+ case 15 : self = UNLOCK
44
+ case 16 : self = BIND
45
+ case 17 : self = REBIND
46
+ case 18 : self = UNBIND
47
+ case 19 : self = ACL
48
+ case 20 : self = REPORT
49
+ case 21 : self = MKACTIVITY
50
+ case 22 : self = CHECKOUT
51
+ case 23 : self = MERGE
52
+ case 24 : self = MSEARCH
53
+ case 25 : self = NOTIFY
54
+ case 26 : self = SUBSCRIBE
55
+ case 27 : self = UNSUBSCRIBE
56
+ case 28 : self = PATCH
57
+ case 29 : self = PURGE
58
+ case 30 : self = MKCALENDAR
59
+ case 31 : self = LINK
60
+ case 32 : self = UNLINK
61
+ default : self = UNKNOWN
62
+ }
63
+ }
64
+ }
0 commit comments