Skip to content

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

:heart: ally

Liyas Thomas5cafc7bb375f
diff --git a/pages/index.vue b/pages/index.vue
index bfec7e08b..0d71340ac 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -9,11 +9,12 @@
<span class="select-wrapper">
<v-popover>
<input
+ v-if="!customMethod"
id="method"
class="method"
- v-if="!customMethod"
v-model="method"
readonly
+ autofocus
/>
<input v-else v-model="method" placeholder="CUSTOM" />
<template slot="popover">
@@ -1349,13 +1350,25 @@ export default {
filenames: "",
navigatorShare: navigator.share,
runningRequest: false,
-
settings: {
SCROLL_INTO_ENABLED:
typeof this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED !== "undefined"
? this.$store.state.postwoman.settings.SCROLL_INTO_ENABLED
: true,
},
+ currentMethodIndex: 0,
+ methodMenuItems: [
+ "GET",
+ "HEAD",
+ "POST",
+ "PUT",
+ "DELETE",
+ "CONNECT",
+ "OPTIONS",
+ "TRACE",
+ "PATCH",
+ "CUSTOM",
+ ],
}
},
watch: {
@@ -2687,20 +2700,44 @@ export default {
} else {
this.cancelRequest()
}
- } else if (e.key === "s" && (e.ctrlKey || e.metaKey)) {
+ }
+ if (e.key === "s" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
this.saveRequest()
- } else if (e.key === "k" && (e.ctrlKey || e.metaKey)) {
+ }
+ if (e.key === "k" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
this.copyRequest()
- } else if (e.key === "j" && (e.ctrlKey || e.metaKey)) {
+ }
+ if (e.key === "j" && (e.ctrlKey || e.metaKey)) {
e.preventDefault()
this.$refs.clearAll.click()
- } else if (e.key === "Escape") {
+ }
+ if (e.key === "Escape") {
e.preventDefault()
this.showModal = this.showTokenList = this.showTokenRequestList = this.showRequestModal = false
this.isHidden = true
}
+ if (e.key === "G" && e.altKey) {
+ this.method = "GET"
+ }
+ if (e.key === "H" && e.altKey) {
+ this.method = "HEAD"
+ }
+ if (e.key === "P" && e.altKey) {
+ this.method = "POST"
+ }
+ if (e.key === "U" && e.altKey) {
+ this.method = "PUT"
+ }
+ if (e.key === "D" && e.altKey) {
+ this.method = "DELETE"
+ }
+ if (e.key == "ArrowUp" && e.altKey && this.currentMethodIndex > 0) {
+ this.method = this.methodMenuItems[--this.currentMethodIndex % this.methodMenuItems.length]
+ } else if (e.key == "ArrowDown" && e.altKey && this.currentMethodIndex < 9) {
+ this.method = this.methodMenuItems[++this.currentMethodIndex % this.methodMenuItems.length]
+ }
}
document.addEventListener("keydown", this._keyListener.bind(this))
await this.oauthRedirectReq()