)
where
+import qualified Data.ByteString.Lazy as B
import Network.HTTP.Lucu.Parser
import Network.HTTP.Lucu.Parser.Http
import Network.HTTP.Lucu.Utils
-- exception for parse error.
parseMIMEType :: String -> MIMEType
parseMIMEType str = case parseStr mimeTypeP str of
- (Success t, _) -> t
- _ -> error ("Unparsable MIME Type: " ++ str)
+ (# Success t, r #) -> if B.null r
+ then t
+ else error ("unparsable MIME Type: " ++ str)
+ (# _ , _ #) -> error ("unparsable MIME Type: " ++ str)
mimeTypeP :: Parser MIMEType