minor refactor

This commit is contained in:
jamesgeorge007
2019-09-23 23:58:04 +05:30
parent 0c873a1c02
commit 8857821716

View File

@@ -612,7 +612,7 @@
requestString.push('xhr.setRequestHeader(' + element.key + ', ' + element.value + ')'); requestString.push('xhr.setRequestHeader(' + element.key + ', ' + element.value + ')');
}) })
} }
if (this.method === 'POST' || this.method === 'PUT') { if (['POST', 'PUT'].includes(this.method)]) {
const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody; const requestBody = this.rawInput ? this.rawParams : this.rawRequestBody;
requestString.push("xhr.setRequestHeader('Content-Length', " + requestBody.length + ")") requestString.push("xhr.setRequestHeader('Content-Length', " + requestBody.length + ")")
requestString.push("xhr.setRequestHeader('Content-Type', `" + this.contentType + "; charset=utf-8`)") requestString.push("xhr.setRequestHeader('Content-Type', `" + this.contentType + "; charset=utf-8`)")