diff --git a/index.html b/index.html index e1bdbec99..8cae51401 100644 --- a/index.html +++ b/index.html @@ -91,7 +91,7 @@
  • - +
  • @@ -99,7 +99,7 @@
  • - +
  • diff --git a/script.js b/script.js index 6b60cd518..cfc1a66ab 100644 --- a/script.js +++ b/script.js @@ -29,6 +29,11 @@ const app = new Vue({ history: window.localStorage.getItem("history") ? JSON.parse(window.localStorage.getItem("history")) : [] }, computed: { + + urlNotValid() { + return !(/(http(s)?:\/\/.)?(www\.)?[-a-zA-Z0-9@:%._\+~#=]{2,256}\.[a-z]{2,6}\b([-a-zA-Z0-9@:%_\+.~#?&//=]*)/g.test(this.url)) + }, + rawRequestBody() { const { bodyParams @@ -86,6 +91,12 @@ const app = new Vue({ document.getElementsByClassName(el)[0].classList.toggle('hidden') }, sendRequest() { + + if (this.urlNotValid) { + alert("Please check the formatting of the URL") + return + } + const n = new Date().toLocaleTimeString() // Latest requests should be placed on top diff --git a/style.css b/style.css index ac167f0c9..1e70137a0 100644 --- a/style.css +++ b/style.css @@ -2,6 +2,7 @@ --bg-color: #121212; --fg-color: #fff; --ac-color: #51FF0D; + --err-color: #FF0000; } * { @@ -164,6 +165,15 @@ textarea { font-family: monospace; } +.error { + border: 1px solid var(--err-color); +} + +.disabled { + background-color: #3C3C3C; + color: #B3B3B3; +} + label { padding: 4px; }