Skip to content

Instantly share code, notes, and snippets.

@dgutov
Created September 23, 2013 15:10
Show Gist options
  • Save dgutov/6671910 to your computer and use it in GitHub Desktop.
Save dgutov/6671910 to your computer and use it in GitHub Desktop.
require 'excon'
# require 'webmock'
# WebMock.allow_net_connect!
s = StringIO.new("muffins")
resp = Excon.put("http://localhost:9292", request_block: lambda { s.read(2).to_s })
puts resp.body
require 'rack'
app = lambda { |env|
[200, {"Content-Type" => "text/plain"}, ["Got: #{env['rack.input'].read}"]]
}
trap('INT') {
Rack::Handler::WEBrick.shutdown
}
Rack::Handler::WEBrick.run(app, :Port => 9292)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment