[fix] Don't access the req.headers before checking if there's an error. Fixes #2