strelka-1: A simple, flexible and composable web-router

Safe HaskellNone
LanguageHaskell2010

Strelka.RequestBodyConsumer

Synopsis

Documentation

newtype RequestBodyConsumer a Source #

A specification of how to consume the request body byte-stream.

Constructors

RequestBodyConsumer (IO ByteString -> IO a) 

foldBytesWithTermination :: (a -> ByteString -> Either a a) -> a -> RequestBodyConsumer a Source #

Fold with support for early termination, which is interpreted from Left.

foldTextWithTermination :: (a -> Text -> Either a a) -> a -> RequestBodyConsumer a Source #

Fold with support for early termination, which is interpreted from Left.

foldBytes :: (a -> ByteString -> a) -> a -> RequestBodyConsumer a Source #

Fold over ByteString chunks.

foldText :: (a -> Text -> a) -> a -> RequestBodyConsumer a Source #

Fold over text chunks decoded using UTF8.

bytes :: RequestBodyConsumer ByteString Source #

Consume as ByteString.

lazyBytes :: RequestBodyConsumer ByteString Source #

Consume as lazy ByteString.

bytesBuilder :: RequestBodyConsumer Builder Source #

Consume as ByteString Builder.

text :: RequestBodyConsumer Text Source #

Consume as Text.

lazyText :: RequestBodyConsumer Text Source #

Consume as lazy Text.

textBuilder :: RequestBodyConsumer Builder Source #

Consume as Text Builder.

bytesParser :: Parser a -> RequestBodyConsumer (Either Text a) Source #

Lift an Attoparsec ByteString parser.

Consumption is non-greedy and terminates when the parser is done.

textParser :: Parser a -> RequestBodyConsumer (Either Text a) Source #

Lift an Attoparsec Text parser.

Consumption is non-greedy and terminates when the parser is done.

parserResult :: Monoid i => (forall a. (a -> i -> Either a a) -> a -> RequestBodyConsumer a) -> IResult i a -> RequestBodyConsumer (Either Text a) Source #

Given a chunk-specialized terminating fold implementation lifts a generic Attoparsec result.