Skip to content

Commit 4416141

Browse files
committed
Change +'' to ''.dup for backwards compat with older versions of ruby
See #733
1 parent b421336 commit 4416141

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/httparty/hash_conversions.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ def self.to_params(hash)
2828
def self.normalize_param(key, value)
2929
normalized_keys = normalize_keys(key, value)
3030

31-
normalized_keys.flatten.each_slice(2).inject(+'') do |string, (k, v)|
31+
normalized_keys.flatten.each_slice(2).inject(''.dup) do |string, (k, v)|
3232
string << "#{ERB::Util.url_encode(k)}=#{ERB::Util.url_encode(v.to_s)}&"
3333
end
3434
end

lib/httparty/request/body.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ def multipart?
3535
def generate_multipart
3636
normalized_params = params.flat_map { |key, value| HashConversions.normalize_keys(key, value) }
3737

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

0 commit comments

Comments
 (0)