X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=Lucu.git;a=blobdiff_plain;f=Network%2FHTTP%2FLucu%2FMultipartForm.hs;h=a28a80461ede0d502d4de626121731c232c940cc;hp=fd85eaf8f907bd506df0042b79dece95c386f85d;hb=b1fac0a;hpb=5e561403ba8ad9c440cc2bf2bacb61ebc3c7a111 diff --git a/Network/HTTP/Lucu/MultipartForm.hs b/Network/HTTP/Lucu/MultipartForm.hs index fd85eaf..a28a804 100644 --- a/Network/HTTP/Lucu/MultipartForm.hs +++ b/Network/HTTP/Lucu/MultipartForm.hs @@ -2,6 +2,7 @@ DoAndIfThenElse , FlexibleContexts , OverloadedStrings + , QuasiQuotes , RecordWildCards , ScopedTypeVariables , UnicodeSyntax @@ -38,7 +39,9 @@ import Data.Text (Text) import qualified Data.Text as T import Network.HTTP.Lucu.Headers import Network.HTTP.Lucu.MIMEParams -import Network.HTTP.Lucu.MIMEType +import Network.HTTP.Lucu.MIMEType (MIMEType) +import qualified Network.HTTP.Lucu.MIMEType as MT +import Network.HTTP.Lucu.MIMEType.TH import Network.HTTP.Lucu.Parser import Network.HTTP.Lucu.Parser.Http import Prelude.Unicode @@ -155,7 +158,7 @@ parsePart boundary src ⧺ e where defaultCType ∷ MIMEType - defaultCType = parseMIMEType "text/plain" + defaultCType = [mimeType| text/plain |] partHeader ∷ Parser Headers partHeader = crlf *> headers @@ -187,7 +190,7 @@ getContType hdrs Nothing → return Nothing Just str - → case parseOnly (finishOff mimeType) $ A.toByteString str of + → case parseOnly (finishOff MT.mimeType) $ A.toByteString str of Right d → return $ Just d Left err → throwError $ "malformed Content-Type: " ⧺ A.toString str