After checking out HTTP GET request in JavaScript? and reading step 7 of "3.6.2. The setRequestHeader() method" in the W3C specs for XMLHttpRequest, I came up with:
function httpGet(url, opts={}) {
var client = new XMLHttpRequest();
client.open('GET', url, false); // not async
if (opts.cookie) {
client.setRequestHeader('Cookie', opts.cookie);
}
client.send();
}
FYI, I'm disregarding the response because I'm deleting a resource (perhaps I should verify the correct response so that I know the resource was deleted). So, yes, this should be a DELETE request, but they configured the server to accept a GET request, and I have no control over this.