From 5ddf4701d177979e686eee0adcf9f6b4484cea06 Mon Sep 17 00:00:00 2001 From: Eric Guo Date: Mon, 11 Jan 2016 00:38:56 +0800 Subject: [PATCH] Must hack here to fix the multipart/form-data boundary number problem. https://github.com/httprb/form_data.rb/issues/4 --- lib/wechat/client.rb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/wechat/client.rb b/lib/wechat/client.rb index 347fce0a..8a2bf6e5 100644 --- a/lib/wechat/client.rb +++ b/lib/wechat/client.rb @@ -28,7 +28,11 @@ def post(path, payload, post_header = {}) def post_file(path, file, post_header = {}) request(path, post_header) do |url, header| params = header.delete(:params) - HTTP.headers(header).post(url, params: params, form: { media: HTTP::FormData::File.new(file) }, ssl_context: ssl_context) + HTTP.headers(header) + .post(url, params: params, + form: { media: HTTP::FormData::File.new(file), + hack: 'X' }, # Existing here for http-form_data 1.0.1 handle single param improperly + ssl_context: ssl_context) end end