1 2 3 4 5 6 7 8 9 10 11 12 13require 'faraday' conn = Faraday.new( url: 'http://mockbin.com', headers: {'Content-Type' => 'multipart/form-data; boundary=---011000010111000001101001'} ) response = conn.post('/har') do |req| req.body = "-----011000010111000001101001\r\nContent-Disposition: form-data; name=\"foo\"; filename=\"hello.txt\"\r\nContent-Type: text/plain\r\n\r\n\r\n-----011000010111000001101001--\r\n" end puts response.status puts response.body