Some helpers for parsing data out of a raw WAI Request
.
- parseQueryString :: ByteString -> [(ByteString, ByteString)]
- parseCookies :: ByteString -> [(ByteString, ByteString)]
- parseHttpAccept :: ByteString -> [ByteString]
- parseRequestBody :: Sink x y -> Request -> 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 {}
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.
parseCookies :: ByteString -> [(ByteString, ByteString)]Source
Decode the value of an HTTP_COOKIE header into key/value pairs.
parseHttpAccept :: ByteString -> [ByteString]Source
Parse the HTTP accept string to determine supported content types.
parseRequestBody :: Sink x y -> Request -> IO ([Param], [File y])Source
A destination for data, the opposite of a Source
.
Sink | |
|
lbsSink :: Sink ([ByteString] -> [ByteString]) ByteStringSource
Information on an uploaded file.
FileInfo | |
|