file-upload icon indicating copy to clipboard operation
file-upload copied to clipboard

Bug using headers

Open Inrego opened this issue 11 years ago • 1 comments

Hey I found a bug when using headers.

  var url = this.target.replace("<name>", file.name);
  xhr.open(this.method, url, true);
  for (key in this.headers) {
    if (headers.hasOwnProperty(key)) {
      xhr.setRequestHeader(key, this.headers[key]);
    }
  }

Should be:

  var url = this.target.replace("<name>", file.name);
  xhr.open(this.method, url, true);
  for (key in this.headers) {
    if (this.headers.hasOwnProperty(key)) {
      xhr.setRequestHeader(key, this.headers[key]);
    }
  }

The change is this.headers in the if-statement. Without this, it'll throw an error that headers is undefined.

Inrego avatar Aug 18 '15 15:08 Inrego

Oh great catch! Thanks so much

winhowes avatar Aug 19 '15 04:08 winhowes