wai-extra-0.3.2.1: Provides some basic WAI handlers and middleware.Source codeContentsIndex
Network.Wai.Parse
Description
Some helpers for parsing data out of a raw WAI Request.
Synopsis
parseQueryString :: ByteString -> [(ByteString, ByteString)]
parseHttpAccept :: ByteString -> [ByteString]
parseRequestBody :: Sink x y -> Request -> Iteratee ByteString IO ([Param], [File y])
data Sink x y = Sink {
sinkInit :: IO x
sinkAppend :: x -> ByteString -> IO x
sinkClose :: x -> IO y
sinkFinalize :: y -> IO ()
}
lbsSink :: Sink ([ByteString] -> [ByteString]) ByteString
tempFileSink :: Sink (FilePath, Handle) FilePath
data FileInfo c = FileInfo {
fileName :: ByteString
fileContentType :: ByteString
fileContent :: c
}
Documentation
parseQueryString :: ByteString -> [(ByteString, ByteString)]Source

Split out the query string into a list of keys and values. A few importants points:

  • There is no way to distinguish between a parameter with no value and a parameter with an empty value. Eg, foo= and foo are the same.
  • The result returned is still bytestrings, since we perform no character decoding here. Most likely, you will want to use UTF-8 decoding, but this is left to the user of the library.
  • Percent decoding errors are ignored. In particular, %Q will be output as %Q.
parseHttpAccept :: ByteString -> [ByteString]Source
Parse the HTTP accept string to determine supported content types.
parseRequestBody :: Sink x y -> Request -> Iteratee ByteString IO ([Param], [File y])Source
data Sink x y Source
A destination for data, the opposite of a Source.
Constructors
Sink
sinkInit :: IO x
sinkAppend :: x -> ByteString -> IO x
sinkClose :: x -> IO y
sinkFinalize :: y -> IO ()
lbsSink :: Sink ([ByteString] -> [ByteString]) ByteStringSource
tempFileSink :: Sink (FilePath, Handle) FilePathSource
data FileInfo c Source
Information on an uploaded file.
Constructors
FileInfo
fileName :: ByteString
fileContentType :: ByteString
fileContent :: c
show/hide Instances
Eq c => Eq (FileInfo c)
Show c => Show (FileInfo c)
Produced by Haddock version 2.6.1