Added redirect response function with tests