Mutation of the response body on `#to_s` and especially on `#to_str` is unexpected and dangerous

require 'httpx'

response = HTTPX.get('http://ojab.ru')

case response
in {body: /not such string in the body/}
  puts 'No string'
in {body: /301 Moved Permanently/}
  puts '301'
in {body: ''}
  puts 'Empty body'
end

Response is generic nginx redirect to https with <head><title>301 Moved Permanently</title></head>, so you expect 301 to be printed, but first check implicitly calls #to_str and body is empty after that, Empty body is printed. Comment first in and it works as expected.

Edited by ojab