-
-
Save smd686s/3952777 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
body = MultipartBody.new(:field1 => 'test', :field2 => 'test2') | |
http = EventMachine::HttpRequest.new('http://example.com').post( | |
:head => {'content-type' => "multipart/form-data; boundary=#{body.boundary}"}, | |
:body => body.to_s | |
) | |
# Or with a file part included | |
part1 = Part.new('name', 'content', 'file.txt') | |
part2 = Part.new('name', 'content', 'file.txt') | |
body = Multipart.new([part1, part2]) | |
http = EventMachine::HttpRequest.new('http://example.com').post( | |
:head => {'content-type' => "multipart/form-data; boundary=#{body.boundary}"}, | |
:body => body.to_s | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment