Open-Source API Development Ecosystem • https://hoppscotch.io • Offline, On-Prem & Cloud • Web, Desktop & CLI • Open-Source Alternative to Postman, Insomnia
TypeScript apiapi-clientapi-restapi-testingdeveloper-toolsgraphqlhttphttp-clientpwarestrest-apispatestingtesting-toolstoolsvuevuejswebsocket
Refactoring based on LGTM analysis
Liyas Thomas2e423b101b35
diff --git a/components/layout/pw-header.vue b/components/layout/pw-header.vueindex c6946c2b7..15c4a6e47 100644--- a/components/layout/pw-header.vue+++ b/components/layout/pw-header.vue@@ -320,7 +320,6 @@ import {hasFirefoxExtensionInstalled,} from "~/helpers/strategies/ExtensionStrategy"import { getPlatformSpecialKey } from "~/helpers/platformutils"-import firebase from "firebase/app"import { fb } from "~/helpers/fb"import closeIcon from "~/static/icons/close-24px.svg?inline"diff --git a/components/ui/js-editor.vue b/components/ui/js-editor.vueindex 8ca051bb7..9d2f87d20 100644--- a/components/ui/js-editor.vue+++ b/components/ui/js-editor.vue@@ -23,7 +23,6 @@ const DEFAULT_THEME = "twilight"import ace from "ace-builds"import "ace-builds/webpack-resolver"-import jsonParse from "~/helpers/jsonParse"import debounce from "~/helpers/utils/debounce"import * as esprima from "esprima"diff --git a/pages/graphql.vue b/pages/graphql.vueindex adaf711b7..7f99031f6 100644--- a/pages/graphql.vue+++ b/pages/graphql.vue@@ -329,7 +329,6 @@</style><script>-import axios from "axios"import * as gql from "graphql"import { commonHeaders } from "~/helpers/headers"import { getPlatformSpecialKey } from "~/helpers/platformutils"diff --git a/pages/index.vue b/pages/index.vueindex 9199470ea..69db43c17 100644--- a/pages/index.vue+++ b/pages/index.vue@@ -171,7 +171,6 @@<i class="material-icons">send</i></span></button>-<button v-else @click="cancelRequest" id="send" ref="sendButton">{{ $t("cancel") }}<span>@@ -1297,20 +1296,6 @@ const statusCategories = [className: "missing-data-response",},]-const parseHeaders = (xhr) => {- const headers = xhr- .getAllResponseHeaders()- .trim()- .split(/[\r\n]+/)- const headerMap = {}- headers.forEach((line) => {- const parts = line.split(": ")- const header = parts.shift().toLowerCase()- const value = parts.join(": ")- headerMap[header] = value- })- return headerMap-}export const findStatusGroup = (responseStatus) =>statusCategories.find(({ statusCodeRegex }) => statusCodeRegex.test(responseStatus))@@ -2071,14 +2056,14 @@ export default {icon: "done",});(() => {- const status = (this.response.status = payload.status)- const headers = (this.response.headers = payload.headers)+ this.response.status = payload.status+ this.response.headers = payload.headers// We don't need to bother parsing JSON, axios already handles it for us!- const body = (this.response.body = payload.data)+ this.response.body = payload.data// Addition of an entry to the history component.const entry = {label: this.requestName,- status,+ status: this.response.status,date: new Date().toLocaleDateString(),time: new Date().toLocaleTimeString(),method: this.method,@@ -2222,7 +2207,7 @@ export default {getQueryStringFromPath() {let queryStringconst pathParsed = url.parse(this.uri)- return (queryString = pathParsed.query ? pathParsed.query : "")+ return pathParsed.query ? pathParsed.query : ""},queryStringToArray(queryString) {const queryParsed = querystring.parse(queryString)@@ -2735,7 +2720,7 @@ export default {if ((e.key === "u" || e.key === "U") && e.altKey) {this.method = "PUT"}- if ((e.key === "x" || e.key === "x") && e.altKey) {+ if ((e.key === "x" || e.key === "X") && e.altKey) {this.method = "DELETE"}if (e.key == "ArrowUp" && e.altKey && this.currentMethodIndex > 0) {diff --git a/pages/settings.vue b/pages/settings.vueindex 797ff1752..9f532d2e9 100644--- a/pages/settings.vue+++ b/pages/settings.vue@@ -257,7 +257,6 @@</template><script>-import firebase from "firebase/app"import { fb } from "~/helpers/fb"import { hasExtensionInstalled } from "../helpers/strategies/ExtensionStrategy"