If printing the res.code isn't so important maybe the three conditions can be merged ```if not res or res.code != 302 or res.headers['Location'] =~ /\/login\.jsp/```