Refactoring based on LGTM analysis
This commit is contained in:
@@ -320,7 +320,6 @@ import {
|
|||||||
hasFirefoxExtensionInstalled,
|
hasFirefoxExtensionInstalled,
|
||||||
} from "~/helpers/strategies/ExtensionStrategy"
|
} from "~/helpers/strategies/ExtensionStrategy"
|
||||||
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
||||||
import firebase from "firebase/app"
|
|
||||||
import { fb } from "~/helpers/fb"
|
import { fb } from "~/helpers/fb"
|
||||||
import closeIcon from "~/static/icons/close-24px.svg?inline"
|
import closeIcon from "~/static/icons/close-24px.svg?inline"
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,6 @@ const DEFAULT_THEME = "twilight"
|
|||||||
|
|
||||||
import ace from "ace-builds"
|
import ace from "ace-builds"
|
||||||
import "ace-builds/webpack-resolver"
|
import "ace-builds/webpack-resolver"
|
||||||
import jsonParse from "~/helpers/jsonParse"
|
|
||||||
import debounce from "~/helpers/utils/debounce"
|
import debounce from "~/helpers/utils/debounce"
|
||||||
|
|
||||||
import * as esprima from "esprima"
|
import * as esprima from "esprima"
|
||||||
|
|||||||
@@ -329,7 +329,6 @@
|
|||||||
</style>
|
</style>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import axios from "axios"
|
|
||||||
import * as gql from "graphql"
|
import * as gql from "graphql"
|
||||||
import { commonHeaders } from "~/helpers/headers"
|
import { commonHeaders } from "~/helpers/headers"
|
||||||
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
import { getPlatformSpecialKey } from "~/helpers/platformutils"
|
||||||
|
|||||||
@@ -171,7 +171,6 @@
|
|||||||
<i class="material-icons">send</i>
|
<i class="material-icons">send</i>
|
||||||
</span>
|
</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button v-else @click="cancelRequest" id="send" ref="sendButton">
|
<button v-else @click="cancelRequest" id="send" ref="sendButton">
|
||||||
{{ $t("cancel") }}
|
{{ $t("cancel") }}
|
||||||
<span>
|
<span>
|
||||||
@@ -1297,20 +1296,6 @@ const statusCategories = [
|
|||||||
className: "missing-data-response",
|
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) =>
|
export const findStatusGroup = (responseStatus) =>
|
||||||
statusCategories.find(({ statusCodeRegex }) => statusCodeRegex.test(responseStatus))
|
statusCategories.find(({ statusCodeRegex }) => statusCodeRegex.test(responseStatus))
|
||||||
|
|
||||||
@@ -2071,14 +2056,14 @@ export default {
|
|||||||
icon: "done",
|
icon: "done",
|
||||||
})
|
})
|
||||||
;(() => {
|
;(() => {
|
||||||
const status = (this.response.status = payload.status)
|
this.response.status = payload.status
|
||||||
const headers = (this.response.headers = payload.headers)
|
this.response.headers = payload.headers
|
||||||
// We don't need to bother parsing JSON, axios already handles it for us!
|
// 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.
|
// Addition of an entry to the history component.
|
||||||
const entry = {
|
const entry = {
|
||||||
label: this.requestName,
|
label: this.requestName,
|
||||||
status,
|
status: this.response.status,
|
||||||
date: new Date().toLocaleDateString(),
|
date: new Date().toLocaleDateString(),
|
||||||
time: new Date().toLocaleTimeString(),
|
time: new Date().toLocaleTimeString(),
|
||||||
method: this.method,
|
method: this.method,
|
||||||
@@ -2222,7 +2207,7 @@ export default {
|
|||||||
getQueryStringFromPath() {
|
getQueryStringFromPath() {
|
||||||
let queryString
|
let queryString
|
||||||
const pathParsed = url.parse(this.uri)
|
const pathParsed = url.parse(this.uri)
|
||||||
return (queryString = pathParsed.query ? pathParsed.query : "")
|
return pathParsed.query ? pathParsed.query : ""
|
||||||
},
|
},
|
||||||
queryStringToArray(queryString) {
|
queryStringToArray(queryString) {
|
||||||
const queryParsed = querystring.parse(queryString)
|
const queryParsed = querystring.parse(queryString)
|
||||||
@@ -2735,7 +2720,7 @@ export default {
|
|||||||
if ((e.key === "u" || e.key === "U") && e.altKey) {
|
if ((e.key === "u" || e.key === "U") && e.altKey) {
|
||||||
this.method = "PUT"
|
this.method = "PUT"
|
||||||
}
|
}
|
||||||
if ((e.key === "x" || e.key === "x") && e.altKey) {
|
if ((e.key === "x" || e.key === "X") && e.altKey) {
|
||||||
this.method = "DELETE"
|
this.method = "DELETE"
|
||||||
}
|
}
|
||||||
if (e.key == "ArrowUp" && e.altKey && this.currentMethodIndex > 0) {
|
if (e.key == "ArrowUp" && e.altKey && this.currentMethodIndex > 0) {
|
||||||
|
|||||||
@@ -257,7 +257,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import firebase from "firebase/app"
|
|
||||||
import { fb } from "~/helpers/fb"
|
import { fb } from "~/helpers/fb"
|
||||||
import { hasExtensionInstalled } from "../helpers/strategies/ExtensionStrategy"
|
import { hasExtensionInstalled } from "../helpers/strategies/ExtensionStrategy"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user