feat: Ensure Method In Endpoint (#2083)
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user