Rework XMLHttpRequest wrapper

@lightsofapollo Thoughts?