Safe Haskell | None |
---|
Ketchup.Utils
- trim ∷ ByteString → ByteString
- breakBS ∷ ByteString → ByteString → (ByteString, ByteString)
- fallback ∷ Maybe a → a → a
- parseBody ∷ ByteString → [(ByteString, ByteString)]
- sendReply ∷ Socket → Int → [(ByteString, [ByteString])] → ByteString → IO ()
- sendBadRequest ∷ Socket → IO ()
- sendNotFound ∷ Socket → IO ()
- statusMsg ∷ Int → ByteString
Documentation
trim ∷ ByteString → ByteString
Trim whitespace from headers
breakBS ∷ ByteString → ByteString → (ByteString, ByteString)
ByteString breakSubstring wrapper that drops delimiters
fallback ∷ Maybe a → a → a
parseBody ∷ ByteString → [(ByteString, ByteString)]
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 ()
Send 400 Bad Request error
sendNotFound ∷ Socket → IO ()
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