@@ -60,6 +60,7 @@ enum Inner {
6060 Trace ,
6161 Connect ,
6262 Patch ,
63+ Query ,
6364 // If the extension is short enough, store it inline
6465 ExtensionInline ( InlineExtension ) ,
6566 // Otherwise, allocate it
@@ -94,6 +95,9 @@ impl Method {
9495 /// TRACE
9596 pub const TRACE : Method = Method ( Trace ) ;
9697
98+ /// QUERY
99+ pub const QUERY : Method = Method ( Query ) ;
100+
97101 /// Converts a slice of bytes to an HTTP method.
98102 pub fn from_bytes ( src : & [ u8 ] ) -> Result < Method , InvalidMethod > {
99103 match src. len ( ) {
@@ -111,6 +115,7 @@ impl Method {
111115 5 => match src {
112116 b"PATCH" => Ok ( Method ( Patch ) ) ,
113117 b"TRACE" => Ok ( Method ( Trace ) ) ,
118+ b"QUERY" => Ok ( Method ( Query ) ) ,
114119 _ => Method :: extension_inline ( src) ,
115120 } ,
116121 6 => match src {
@@ -146,7 +151,7 @@ impl Method {
146151 /// See [the spec](https://tools.ietf.org/html/rfc7231#section-4.2.1)
147152 /// for more words.
148153 pub fn is_safe ( & self ) -> bool {
149- matches ! ( self . 0 , Get | Head | Options | Trace )
154+ matches ! ( self . 0 , Get | Head | Options | Trace | Query )
150155 }
151156
152157 /// Whether a method is considered "idempotent", meaning the request has
@@ -174,6 +179,7 @@ impl Method {
174179 Trace => "TRACE" ,
175180 Connect => "CONNECT" ,
176181 Patch => "PATCH" ,
182+ Query => "QUERY" ,
177183 ExtensionInline ( ref inline) => inline. as_str ( ) ,
178184 ExtensionAllocated ( ref allocated) => allocated. as_str ( ) ,
179185 }
@@ -466,6 +472,7 @@ mod test {
466472 assert ! ( Method :: DELETE . is_idempotent( ) ) ;
467473 assert ! ( Method :: HEAD . is_idempotent( ) ) ;
468474 assert ! ( Method :: TRACE . is_idempotent( ) ) ;
475+ assert ! ( Method :: QUERY . is_idempotent( ) ) ;
469476
470477 assert ! ( !Method :: POST . is_idempotent( ) ) ;
471478 assert ! ( !Method :: CONNECT . is_idempotent( ) ) ;
0 commit comments