[delete image] Add request for deleting a manifest/image.

Add setRequestHeader in Http class.
This commit is contained in:
Joxit 2016-07-14 23:50:43 +02:00 committed by Joxit
parent 70f860f813
commit 7150fe3245
2 changed files with 43 additions and 0 deletions

View file

@ -17,6 +17,7 @@
function Http() {
this.oReq = new XMLHttpRequest();
this._events = {};
this._headers = {};
}
Http.prototype.addEventListener = function(e, f) {
@ -31,6 +32,9 @@ Http.prototype.addEventListener = function(e, f) {
for (key in this.http._events) {
req.addEventListener(key, this.http._events[key]);
}
for (key in this.http._headers) {
req.setRequestHeader(key, this.http._headers[key]);
}
req.withCredentials = true;
req.open(this.http._method, this.http._url);
req.send();
@ -50,6 +54,11 @@ Http.prototype.addEventListener = function(e, f) {
}
};
Http.prototype.setRequestHeader = function(header, value) {
this.oReq.setRequestHeader(header, value);
this._headers[header] = value;
};
Http.prototype.open = function(m, u) {
this._method = m;
this._url = u;