Fix intermittent errors for redirect

Add assertion of header before checking URL redirect

Fixes: https://www.pivotaltracker.com/story/show/49712465
Merge pull request #162 from faun/fix_intermittent_failures

Fix intermittent errors for redirect