Skip to content

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

fix: request endpoint heading (#3804)

Anwarul Islam0ba33ec18750
diff --git a/packages/hoppscotch-common/src/components/http/Request.vue b/packages/hoppscotch-common/src/components/http/Request.vue
index f92b5631d..d71ad238e 100644
--- a/packages/hoppscotch-common/src/components/http/Request.vue
+++ b/packages/hoppscotch-common/src/components/http/Request.vue
@@ -395,17 +395,14 @@ const newSendRequest = async () => {
}
const ensureMethodInEndpoint = () => {
- if (
- !/^http[s]?:\/\//.test(newEndpoint.value) &&
- !newEndpoint.value.startsWith("<<")
- ) {
- const domain = newEndpoint.value.split(/[/:#?]+/)[0]
+ const endpoint = newEndpoint.value.trim()
+ tab.value.document.request.endpoint = endpoint
+ if (!/^http[s]?:\/\//.test(endpoint) && !endpoint.startsWith("<<")) {
+ const domain = endpoint.split(/[/:#?]+/)[0]
if (domain === "localhost" || /([0-9]+\.)*[0-9]/.test(domain)) {
- tab.value.document.request.endpoint =
- "http://" + tab.value.document.request.endpoint
+ tab.value.document.request.endpoint = "http://" + endpoint
} else {
- tab.value.document.request.endpoint =
- "https://" + tab.value.document.request.endpoint
+ tab.value.document.request.endpoint = "https://" + endpoint
}
}
}