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
⚡ Better URL parsing
Liyas Thomas1c6f87784bd9
diff --git a/pages/index.vue b/pages/index.vueindex d7f614ac5..fcd78dd34 100644--- a/pages/index.vue+++ b/pages/index.vue@@ -2011,10 +2011,9 @@ export default {let text = textarea.value;try {let parsedCurl = parseCurlCommand(text);- this.url = parsedCurl.url.replace(/"/g, "").replace(/'/g, "");- this.url =- this.url.slice(-1).pop() === "/" ? this.url.slice(0, -1) : this.url;- this.path = "";+ let url = new URL(parsedCurl.url.replace(/"/g, "").replace(/'/g, ""));+ this.url = url.origin;+ this.path = url.pathname;this.headers = [];for (const key of Object.keys(parsedCurl.headers)) {this.$store.commit("addHeaders", {