Skip to content

Commit

Permalink
Prefer match? over match RB-PR1018
Browse files Browse the repository at this point in the history
  • Loading branch information
Eric-Guo committed Jan 4, 2024
1 parent d4a992d commit 8e47c5f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/wechat/http_client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def parse_response(response, as_type)
%r{^voice/.*} => :file,
%r{^text/html} => :xml,
%r{^text/plain} => :probably_json
}.each_with_object([]) { |match, memo| memo << match[1] if content_type =~ match[0] }.first || as_type || :text
}.each_with_object([]) { |match, memo| memo << match[1] if content_type.match?(match[0]) }.first || as_type || :text

# try to parse response as json, fallback to user-specified format or text if failed
if parse_as == :probably_json
Expand Down

0 comments on commit 8e47c5f

Please sign in to comment.