From 17d6ae15a5e89550af3cc6ea8a29ca3bac8283ba Mon Sep 17 00:00:00 2001 From: Rakibul Yeasin Date: Fri, 6 Oct 2023 12:27:26 +0600 Subject: [PATCH] fix: Cannot set custom method #3406 (#3408) * fix: #3406 * chore: remove console log * fix: an unknown keyboard event issue --------- Co-authored-by: Liyas Thomas Co-authored-by: Anwarul Islam --- packages/hoppscotch-common/src/components/http/Request.vue | 2 +- packages/hoppscotch-common/src/helpers/keybindings.ts | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/hoppscotch-common/src/components/http/Request.vue b/packages/hoppscotch-common/src/components/http/Request.vue index 8baba9ca0..1cedab3d1 100644 --- a/packages/hoppscotch-common/src/components/http/Request.vue +++ b/packages/hoppscotch-common/src/components/http/Request.vue @@ -426,7 +426,7 @@ const updateMethod = (method: string) => { const onSelectMethod = (e: Event | any) => { // type any because of value property not being recognized by TS in the event.target object. It is a valid property though. - updateMethod(e.value) + updateMethod(e.target.value) } const clearContent = () => { diff --git a/packages/hoppscotch-common/src/helpers/keybindings.ts b/packages/hoppscotch-common/src/helpers/keybindings.ts index 499bc2ce4..f6b0ca611 100644 --- a/packages/hoppscotch-common/src/helpers/keybindings.ts +++ b/packages/hoppscotch-common/src/helpers/keybindings.ts @@ -131,7 +131,8 @@ function generateKeybindingString(ev: KeyboardEvent): ShortcutKey | null { } function getPressedKey(ev: KeyboardEvent): Key | null { - const val = ev.code.toLowerCase() + // Sometimes the property code is not available on the KeyboardEvent object + const val = (ev.code ?? "").toLowerCase() // Check arrow keys if (val === "arrowup") return "up"