Skip to content

Commit

Permalink
Change +'' to ''.dup for backwards compat with older versions of ruby
Browse files Browse the repository at this point in the history
See #733
  • Loading branch information
jnunemaker committed Sep 29, 2021
1 parent b421336 commit 4416141
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lib/httparty/hash_conversions.rb
Expand Up @@ -28,7 +28,7 @@ def self.to_params(hash)
def self.normalize_param(key, value)
normalized_keys = normalize_keys(key, value)

normalized_keys.flatten.each_slice(2).inject(+'') do |string, (k, v)|
normalized_keys.flatten.each_slice(2).inject(''.dup) do |string, (k, v)|
string << "#{ERB::Util.url_encode(k)}=#{ERB::Util.url_encode(v.to_s)}&"
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/httparty/request/body.rb
Expand Up @@ -35,7 +35,7 @@ def multipart?
def generate_multipart
normalized_params = params.flat_map { |key, value| HashConversions.normalize_keys(key, value) }

multipart = normalized_params.inject(+'') do |memo, (key, value)|
multipart = normalized_params.inject(''.dup) do |memo, (key, value)|
memo << "--#{boundary}#{NEWLINE}"
memo << %(Content-Disposition: form-data; name="#{key}")
# value.path is used to support ActionDispatch::Http::UploadedFile
Expand Down

1 comment on commit 4416141

@aliismayilov
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if this commit should be reverted, now that ruby >=2.3 is required #736

Please sign in to comment.