res should be checked to not be nil before proceeding with that. My preferred way is:

```ruby
if res and res.body
    res.body.gsub(....)
end
```