Avoid modifying frozen strings#649
Conversation
Signed-off-by: Alexandre Terrasa <alexandre@moz-code.org>
|
I thought |
|
Well, if someone to run ruby with |
|
I don't think those issues are related. You can reproduce the problem with |
|
@rafaelfranca thanks for clarifying, you're right @Morriar sorry it look so long to review and thatnks for the pr |
|
@rafaelfranca @Morriar actually, I think I merged this too soon. The thing is
Second parameter accepts hash, not a string. So I can't really reproduce it 😕 |
|
This is a combination between stubs using webmock and using httparty as client. In a test like: this would fail. |
|
Ah, I see. Didn't think about this use-case. Thanks for explaining @rafaelfranca |
Calling the
force_encodingmethod on frozen strings can be a problem.Especially for people using the
# frozen_string_literal: trueannotation.To protect it, I added a call to
dupbefore all calls toforce_encoding.If we decide the bump the ruby version to something newer we could use the
+.Signed-off-by: Alexandre Terrasa alexandre@moz-code.org