Skip to content

Commit

Permalink
Avoid modifying frozen string when receiving unexpected response
Browse files Browse the repository at this point in the history
  • Loading branch information
p0deje committed Mar 26, 2019
1 parent d14b44d commit 2a3fd4c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions rb/lib/selenium/webdriver/remote/http/common.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,11 @@ def create_response(code, body, content_type)
elsif code == 204
Response.new(code)
else
msg = "unexpected response, code=#{code}, content-type=#{content_type.inspect}"
msg << "\n#{body}" unless body.empty?
msg = if body.empty?
"unexpected response, code=#{code}, content-type=#{content_type.inspect}"
else
"unexpected response, code=#{code}, content-type=#{content_type.inspect}\n#{body}"
end

raise Error::WebDriverError, msg
end
Expand Down

0 comments on commit 2a3fd4c

Please sign in to comment.