Skip to content

Instantly share code, notes, and snippets.

@myronmarston
Forked from marios/Runtest.rb
Created November 7, 2011 07:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save myronmarston/1344398 to your computer and use it in GitHub Desktop.
Save myronmarston/1344398 to your computer and use it in GitHub Desktop.
the request body
$ ruby vcr_excon_test.rb
Using string body:
- "the request body\n"
Using Rack::Test::UploadedFile body:
- ""
require 'sinatra'
post '/' do
request.body.rewind
request.body.read
end
require 'rubygems'
require 'rack/test'
require 'excon'
puts "Using string body: "
puts " - " + Excon.post("http://localhost:4567/", :body => File.read('./file.txt')).body.inspect
puts "Using Rack::Test::UploadedFile body: "
puts " - " + Excon.post("http://localhost:4567/", :body => Rack::Test::UploadedFile.new("./file.txt", "text/plain")).body.inspect
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment