undefined method `each' for #<String:0x00007fe4146de750> in CURL logger formatter

9 views
Skip to first unread message

Richardson R

unread,
Apr 29, 2021, 9:06:28 AM4/29/21
to HTTParty Gem
Following the guidelines in the contributing file, I'm posting this here and I'm not creating an issue in the Github repository. 

Sometimes this happens when using the logger with the curl formatter.

undefined method `each' for #<String:0x00007fe4146de750>
/path../httparty-0.18.1/lib/httparty/logger/curl_formatter.rb:79:in `log_hash'
/path../httparty-0.18.1/lib/httparty/logger/curl_formatter.rb:68:in `log_query'
/path../httparty-0.18.1/lib/httparty/logger/curl_formatter.rb:34:in `log_request'
/path../httparty-0.18.1/lib/httparty/logger/curl_formatter.rb:20:in `format'
/path../httparty-0.18.1/lib/httparty/response.rb:28:in `initialize'
/path../httparty-0.18.1/lib/httparty/request.rb:295:in `new'


The issue is in this method: 

def log_hash(hash)
   hash.each { |k, v| log(OUT, "#{k}: #{v}") }
end

The fix is pretty simple to fix. The thing is: I don' t know how to reproduce it 


jnunemaker

unread,
Apr 29, 2021, 12:03:31 PM4/29/21
to HTTParty Gem
Weird. Not sure what would cause that either. If you can somehow reproduce it I'm game for a PR/fix. 
Reply all
Reply to author
Forward
0 new messages