Created
March 24, 2015 00:18
-
-
Save tbreier/ee35b59e598d44535452 to your computer and use it in GitHub Desktop.
Faraday Encoding
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 'faraday' | |
connection = Faraday.new do |c| | |
c.response :logger | |
c.adapter Faraday.default_adapter | |
end | |
connection.token_auth 'my_token' | |
connection.post do |request| | |
request.url 'http://www.posttestserver.com/' # returns 200 Success when I use my Rails server | |
request.body = "From: \"Me\" <info@info.com>\nTo: \"You\" <info@info.com>\nHello" | |
end | |
puts "----------------------------------------------" | |
connection.post do |request| | |
request.url 'http://www.posttestserver.com/' # returns 400 Bad Request when I use my Rails server | |
request.body = "From: \"Me\" <info@info.com>\nTo: \"You\" <info@info.com>\nHello %%" | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment