| Safe Haskell | None |
|---|
Ketchup.Utils
- trim :: ByteString -> ByteString
- breakBS :: ByteString -> ByteString -> (ByteString, ByteString)
- parseBody :: ByteString -> Map ByteString ByteString
- sendReply :: Socket -> Int -> [(ByteString, [ByteString])] -> ByteString -> IO ()
- sendBadRequest :: Socket -> IO ()
- sendNotFound :: Socket -> IO ()
- statusMsg :: Int -> ByteString
Documentation
trim :: ByteString -> ByteStringSource
Trim whitespace from headers
breakBS :: ByteString -> ByteString -> (ByteString, ByteString)Source
ByteString breakSubstring wrapper that drops delimiters
parseBody :: ByteString -> Map ByteString ByteStringSource
Parse a URL-encoded Request
Arguments
| :: Socket | Socket to write to |
| -> Int | Status Code to send |
| -> [(ByteString, [ByteString])] | |
| -> ByteString | Body |
| -> IO () |
Send a HTTP reply Sends a reply with the given parameters
sendBadRequest :: Socket -> IO ()Source
Send 400 Bad Request error
sendNotFound :: Socket -> IO ()Source
Send 404 Not Found error
Arguments
| :: Int | Status code (ex. 404) |
| -> ByteString | Status message (ex. 404 Not Found) |
Status Messages Returns status message from a given status id