httpclient icon indicating copy to clipboard operation
httpclient copied to clipboard

multipart file upload problem

Open kikonen opened this issue 7 years ago • 0 comments

It looks like file_in_form_data? logic doesn't work as expected. Documentation states that "body" should be array, and HTTP::Message.multiparam_query?(body) seems to handle that. However, "body.any? { |k, v| HTTP::Message.file?(v) }" part works only if body is Hash.

class HttpClient
  def file_in_form_data?(body)
    HTTP::Message.multiparam_query?(body) &&
      body.any? { |k, v| HTTP::Message.file?(v) }
  end
end

kikonen avatar Apr 04 '17 13:04 kikonen