+ HttpMethod.scala (fix)
authorAlexandre Bertails <bertails@gmail.com>
Sun, 13 Nov 2011 21:55:08 -0500
changeset 116 bb4db35de6a7
parent 115 cffe1a122b23
child 117 16ee2a3139fe
child 118 df96d8590cd2
+ HttpMethod.scala (fix)
src/main/scala/util/HttpMethod.scala
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/main/scala/util/HttpMethod.scala	Sun Nov 13 21:55:08 2011 -0500
@@ -0,0 +1,20 @@
+package org.w3.readwriteweb.util
+
+import unfiltered.request._
+
+// TODO pull request to the unfiltered project!
+object HttpMethod {
+  def unapply(req: HttpRequest[_]): Option[Method] =
+    Some(
+      req.method match {
+        case "GET" => GET
+        case "PUT" => PUT
+        case "HEAD" => HEAD
+        case "POST" => POST
+        case "CONNECT" => CONNECT
+        case "OPTIONS" => OPTIONS
+        case "TRACE" => TRACE
+        case m => new Method(m)
+      })
+
+}
\ No newline at end of file