more robust checking for status code
Merge pull request #2 from vitorgalvao/more-robust-headers

more robust checking for status code