Created
May 12, 2013 18:00
-
-
Save MichaelXavier/5564392 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'sinatra' | |
require 'pp' | |
delete '/' do | |
"you DELETED: #{request.body.string}" | |
end | |
put '/' do | |
"you PUTTED: #{request.body.string}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{-# LANGUAGE OverloadedStrings #-} | |
import System.IO.Streams (InputStream, OutputStream, stdout) | |
import qualified System.IO.Streams as Streams | |
import qualified Data.ByteString as S | |
import Network.Http.Client | |
main :: IO () | |
main = do | |
withConnection (openConnection "localhost" 4567) $ \c -> do | |
stream <- Streams.fromLazyByteString "SERVER SHOULD GET THIS BODY" | |
q <- buildRequest $ do | |
http DELETE "/" -- no body gets sent | |
--http PUT "/" -- body gets sent | |
setAccept "text/html" | |
sendRequest c q $ inputStreamBody stream | |
receiveResponse c debugHandler |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment