Support for validating server output on-the-fly. Validators can be configured on a per content-type basis.
- setValidator :: (Response -> IO Response) -> Response -> Response
- setValidatorSP :: (Monad m, ToMessage r) => (Response -> IO Response) -> m r -> m Response
- validateConf :: Conf
- runValidator :: (Response -> IO Response) -> Response -> IO Response
- wdgHTMLValidator :: (MonadIO m, ToMessage r) => r -> m Response
- noopValidator :: Response -> IO Response
- lazyProcValidator :: FilePath -> [String] -> Maybe FilePath -> Maybe [(String, String)] -> (Maybe ByteString -> Bool) -> Response -> IO Response
Set the validator which should be used for this particular
Response when validation is enabled.
Calling this function does not enable validation. That can only be
done by enabling the validation in the
Conf that is passed to
You do not need to call this function if the validator set in
Conf does what you want already.
simpleHTTP validateConf $ ok . setValidator noopValidator =<< htmlPage
A validator which always succeeds.
Useful for selectively disabling validation. For example, if you are sending down HTML fragments to an AJAX application and the default validator only understands complete documents.
name of executable
arguments to pass to the executable
|-> Maybe FilePath|
optional path to working directory
|-> Maybe [(String, String)]|
optional environment (otherwise inherit)
|-> (Maybe ByteString -> Bool)|
Response to validate
|-> IO Response|
Response using an external application.
If the external application returns 0, the original response is
returned unmodified. If the external application returns non-zero,
Response containing the error messages and original response
body is returned instead.
This function also takes a predicate filter which is applied to the content-type of the response. The filter will only be applied if the predicate returns true.
NOTE: This function requires the use of -threaded to avoid blocking. However, you probably need that for Happstack anyway.