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