Skip to content

Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia

minor refactor

jamesgeorge007885782171609
diff --git a/pages/index.vue b/pages/index.vue
index f0b230f2b..5b6d084c9 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -612,7 +612,7 @@
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;
requestString.push("xhr.setRequestHeader('Content-Length', " + requestBody.length + ")")
requestString.push("xhr.setRequestHeader('Content-Type', `" + this.contentType + "; charset=utf-8`)")