@@ -14,6 +14,7 @@ import Control.Arrow
1414import Network.Wai.Middleware.Jsonp
1515import Network.Wai.Middleware.Gzip
1616import Network.Wai.Middleware.Vhost
17+import Network.Wai.Middleware.Autohead
1718import Codec.Compression.GZip (decompress)
1819
1920import Data.Enumerator (run_, enumList, ($$))
@@ -36,6 +37,7 @@ testSuite = testGroup "Network.Wai.Parse"
3637 , testCase "jsonp" caseJsonp
3738 , testCase "gzip" caseGzip
3839 , testCase "vhost" caseVhost
40+ , testCase "autohead" caseAutohead
3941 ]
4042
4143caseParseQueryString :: Assertion
@@ -262,3 +264,19 @@ caseVhost = flip runSession vhostApp $ do
262264 { serverName = "bar.com"
263265 }
264266 assertBody "app2" sres2
267+
268+autoheadApp = autohead $ const $ return $ responseLBS status200
269+ [("Foo", "Bar")] "body"
270+
271+caseAutohead = flip runSession autoheadApp $ do
272+ sres1 <- request Request
273+ { requestMethod = "GET"
274+ }
275+ assertHeader "Foo" "Bar" sres1
276+ assertBody "body" sres1
277+
278+ sres1 <- request Request
279+ { requestMethod = "HEAD"
280+ }
281+ assertHeader "Foo" "Bar" sres1
282+ assertBody "" sres1