Ketchup-0.4.3: A super small web framework for those who don't like big and fancy codebases

Safe HaskellNone




breakBS :: ByteString -> ByteString -> (ByteString, ByteString) Source

ByteString breakSubstring wrapper that drops delimiters

fallback :: Maybe a -> a -> a Source

Maybe a -> a with fallback (if Nothing)

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

sendReply Source


:: Socket

Socket to write to

-> Int

Status Code to send

-> [(ByteString, [ByteString])]

HTTP headers (Header,["value1", "value2"])

-> ByteString


-> IO () 

Send a HTTP reply Sends a reply with the given parameters

statusMsg Source


:: 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