Add some additional hacks to work in the browser.
Add some code comments about why we do the extra checks.
Merge pull request #944 from eiriksm/browserify-changes

Make request work with browserify