Permalink
Browse files

Merge commit 'da7ddad387a6b1c0219a7f3b923b46d7926362f3'

  • Loading branch information...
gregorycollins committed Jun 12, 2012
2 parents 156da83 + da7ddad commit 0fc1d888226825fbe713fbaad4dcb74fd34f91dc
Showing with 8 additions and 5 deletions.
  1. +2 −2 src/Snap/Internal/Http/Parser.hs
  2. +6 −3 test/suite/Snap/Internal/Http/Server/Tests.hs
@@ -171,8 +171,8 @@ methodFromString "DELETE" = return DELETE
methodFromString "TRACE" = return TRACE
methodFromString "OPTIONS" = return OPTIONS
methodFromString "CONNECT" = return CONNECT
-methodFromString s =
- throwError $ HttpParseException $ "Bad method '" ++ S.unpack s ++ "'"
+methodFromString "PATCH" = return PATCH
+methodFromString s = return $ Method s
------------------------------------------------------------------------------
@@ -152,7 +152,8 @@ testMethodParsing :: Test
testMethodParsing =
testCase "server/method parsing" $ Prelude.mapM_ testOneMethod ms
where
- ms = [ GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT ]
+ ms = [ GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS, CONNECT, PATCH
+ , Method "COPY", Method "MOVE" ]
dummyIter :: Iteratee ByteString IO ()
@@ -272,9 +273,11 @@ testPartialParse = testCase "server/short" $ do
methodTestText :: Method -> L.ByteString
-methodTestText m = L.concat [ (L.pack $ map c2w $ show m)
+methodTestText m = L.concat [ mbs m
, " / HTTP/1.1\r\nContent-Length: 0\r\n\r\n" ]
-
+ where
+ mbs (Method b) = L.fromChunks [b]
+ mbs b = L.pack $ map c2w $ show b
sampleRequest2 :: ByteString
sampleRequest2 =

0 comments on commit 0fc1d88

Please sign in to comment.