Safe Haskell | None |
---|
Some helpers for parsing data out of a raw WAI Request
.
- parseHttpAccept :: ByteString -> [ByteString]
- parseRequestBody :: BackEnd y -> Request -> IO ([Param], [File y])
- data RequestBodyType
- getRequestBodyType :: Request -> Maybe RequestBodyType
- sinkRequestBody :: BackEnd y -> RequestBodyType -> Sink ByteString IO ([Param], [File y])
- conduitRequestBody :: BackEnd y -> RequestBodyType -> Conduit ByteString IO (Either Param (File y))
- type BackEnd a = ByteString -> FileInfo () -> Sink ByteString IO a
- lbsBackEnd :: Monad m => ignored1 -> ignored2 -> Sink ByteString m ByteString
- tempFileBackEnd :: InternalState -> ignored1 -> ignored2 -> Sink ByteString IO FilePath
- tempFileBackEndOpts :: IO FilePath -> String -> InternalState -> ignored1 -> ignored2 -> Sink ByteString IO FilePath
- type Param = (ByteString, ByteString)
- type File y = (ByteString, FileInfo y)
- data FileInfo c = FileInfo {}
- parseContentType :: ByteString -> (ByteString, [(ByteString, ByteString)])
Documentation
parseHttpAccept :: ByteString -> [ByteString]Source
Parse the HTTP accept string to determine supported content types.
sinkRequestBody :: BackEnd y -> RequestBodyType -> Sink ByteString IO ([Param], [File y])Source
conduitRequestBody :: BackEnd y -> RequestBodyType -> Conduit ByteString IO (Either Param (File y))Source
= ByteString | parameter name |
-> FileInfo () | |
-> Sink ByteString IO a |
A file uploading backend. Takes the parameter name, file name, and content
type, and returns a Sink
for storing the contents.
lbsBackEnd :: Monad m => ignored1 -> ignored2 -> Sink ByteString m ByteStringSource
Store uploaded files in memory
tempFileBackEnd :: InternalState -> ignored1 -> ignored2 -> Sink ByteString IO FilePathSource
Save uploaded files on disk as temporary files
Note: starting with version 2.0, it is the responsibility of the caller to remove any temp files created by using this backend.
:: IO FilePath | get temporary directory |
-> String | filename pattern |
-> InternalState | |
-> ignored1 | |
-> ignored2 | |
-> Sink ByteString IO FilePath |
Same as tempFileSink
, but use configurable temp folders and patterns.
type Param = (ByteString, ByteString)Source
Post parameter name and value.
type File y = (ByteString, FileInfo y)Source
Post parameter name and associated file information.
Information on an uploaded file.
FileInfo | |
|
parseContentType :: ByteString -> (ByteString, [(ByteString, ByteString)])Source
Parse a content type value, turning a single ByteString
into the actual
content type and a list of pairs of attributes.
Since 1.3.2