I've read all of the other related answers I've been able to find, but none has worked. Essentially, I want to make this source: https://github.com/gildas-lormeau/zip.js/blob/master/WebContent/zip-ext.js
add some custom headers to the XMLHttpRequest on line 93. Since HTTPRangeReader is wrapped in an anonymous function, I can't monkeypatch it directly, and it seems the only option is to monkeypatch the XMLHttpRequest constructor. I just need to call the default constructor and then call setRequestHeader() one or more times before returning the new object.