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
feat: Ensure Method In Endpoint (#2083)
Rishabh Agarwal78693964d8a9
diff --git a/packages/hoppscotch-app/components/http/Request.vue b/packages/hoppscotch-app/components/http/Request.vueindex f14e5ed6c..353eda679 100644--- a/packages/hoppscotch-app/components/http/Request.vue+++ b/packages/hoppscotch-app/components/http/Request.vue@@ -307,6 +307,8 @@ const newSendRequest = async () => {return}+ ensureMethodInEndpoint()+loading.value = true// Double calling is because the function returns a TaskEither than should be executed@@ -345,6 +347,17 @@ const newSendRequest = async () => {}}+const ensureMethodInEndpoint = () => {+ if (!/^http[s]?:\/\//.test(newEndpoint.value)) {+ const domain = newEndpoint.value.split(/[/:#?]+/)[0]+ if (domain === "localhost" || /([0-9]+\.)*[0-9]/.test(domain)) {+ setRESTEndpoint("http://" + newEndpoint.value)+ } else {+ setRESTEndpoint("https://" + newEndpoint.value)+ }+ }+}+const onPasteUrl = (e: { event: ClipboardEvent; previousValue: string }) => {if (!e) return