Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- data Body
- = JSONBody (Maybe Value)
- | RawBody ByteString
- data BodyTransformFn
- = Remove
- | ModifyAsJSON Template
- | ModifyAsFormURLEncoded (HashMap Text UnescapedTemplate)
- applyBodyTransformFn :: MonadError TransformErrorBundle m => BodyTransformFn -> RequestTransformCtx -> Body -> m Body
- validateBodyTransformFn :: TemplatingEngine -> BodyTransformFn -> Validation TransformErrorBundle ()
- foldFormEncoded :: HashMap Text ByteString -> ByteString
- escapeURIText :: Text -> Text
- escapeURIBS :: ByteString -> ByteString
Documentation
HTTP message body being transformed.
JSONBody (Maybe Value) | |
RawBody ByteString |
Instances
data BodyTransformFn Source #
The transformations which can be applied to an HTTP message body.
Remove | Remove the HTTP message body. |
ModifyAsJSON Template | Modify the JSON message body by applying a |
ModifyAsFormURLEncoded (HashMap Text UnescapedTemplate) | Modify the JSON message body by applying |
Instances
applyBodyTransformFn :: MonadError TransformErrorBundle m => BodyTransformFn -> RequestTransformCtx -> Body -> m Body Source #
Provide an implementation for the transformations defined by
BodyTransformFn
.
If one views BodyTransformFn
as an interface describing HTTP message body
transformations, this can be seen as an implementation of these
transformations as normal Haskell functions.
validateBodyTransformFn :: TemplatingEngine -> BodyTransformFn -> Validation TransformErrorBundle () Source #
Validate that the provided BodyTransformFn
is correct in the context of
a particular TemplatingEngine
.
This is a product of the fact that the correctness of a given transformation
may be dependent on zero, one, or more of the templated transformations
encoded within the given BodyTransformFn
.
foldFormEncoded :: HashMap Text ByteString -> ByteString Source #
Fold a HashMap
of header key/value pairs into an
x-www-form-urlencoded
message body.
escapeURIText :: Text -> Text Source #
URI-escape Text
blobs.
escapeURIBS :: ByteString -> ByteString Source #
URI-escape ByteString
blobs, which are presumed to represent Text
.
XXX: This function makes internal usage of decodeUtf8
, which throws an
impure exception when the supplied ByteString
cannot be decoded into valid
UTF8 text!