-
-
Save myronmarston/1344398 to your computer and use it in GitHub Desktop.
Example for https://github.com/myronmarston/vcr/issues/101
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
the request body |
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
$ ruby vcr_excon_test.rb | |
Using string body: | |
- "the request body\n" | |
Using Rack::Test::UploadedFile body: | |
- "" | |
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' | |
post '/' do | |
request.body.rewind | |
request.body.read | |
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
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