Merge branch 'master' into update-proxy-info

This commit is contained in:
Liyas Thomas
2020-02-28 03:53:55 +05:30
committed by GitHub

View File

@@ -1530,30 +1530,26 @@ export default {
computed: { computed: {
uri: { uri: {
get() { get() {
return this.$store.state.request.uri ? return this.$store.state.request.uri ? this.$store.state.request.uri : this.url + this.path
this.$store.state.request.uri
: this.url + this.path;
}, },
set(value) { set(value) {
this.$store.commit("setState", { value, attribute: "uri" }) this.$store.commit("setState", { value, attribute: "uri" })
let url; let url
if (this.preRequestScript && this.showPreRequestScript) { if (this.preRequestScript && this.showPreRequestScript) {
const environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript); const environmentVariables = getEnvironmentVariablesFromScript(this.preRequestScript)
url = parseTemplateString(value, environmentVariables); url = parseTemplateString(value, environmentVariables)
} }
try { try {
url = new URL(url); url = new URL(url)
this.url = url.origin; this.url = url.origin
this.path = url.pathname; this.path = url.pathname
} catch(error) { } catch (error) {
console.log(error) console.log(error)
let uriRegex = value.match( let uriRegex = value.match(/^((http[s]?:\/\/)?(<<[^\/]+>>)?[^\/]*|)(\/?.*)$/)
/^((http[s]?:\/\/)?(<<[^\/]+>>)?[^\/]*|)(\/?.*)$/ this.url = uriRegex[1]
); this.path = uriRegex[4]
this.url = uriRegex[1];
this.path = uriRegex[4];
} }
} },
}, },
url: { url: {
get() { get() {
@@ -2067,7 +2063,7 @@ export default {
const formData = new FormData() const formData = new FormData()
for (let i = 0; i < this.files.length; i++) { for (let i = 0; i < this.files.length; i++) {
let file = this.files[i] let file = this.files[i]
formData.append(`files[${i}]`, file) formData.append(i, file)
} }
formData.append("data", requestBody) formData.append("data", requestBody)
requestBody = formData requestBody = formData
@@ -2411,8 +2407,8 @@ export default {
const sendButtonElement = this.$refs.sendButton const sendButtonElement = this.$refs.sendButton
const observer = new IntersectionObserver( const observer = new IntersectionObserver(
(entries, observer) => { (entries, observer) => {
entries.forEach(entry => { entries.forEach(({ isIntersecting }) => {
if (entry.isIntersecting) sendButtonElement.classList.remove("show") if (isIntersecting) sendButtonElement.classList.remove("show")
// The button should float when it is no longer visible on screen. // The button should float when it is no longer visible on screen.
// This is done by adding the show class to the button. // This is done by adding the show class to the button.
else sendButtonElement.classList.add("show") else sendButtonElement.classList.add("show")
@@ -2457,7 +2453,7 @@ export default {
switchVisibility() { switchVisibility() {
this.passwordFieldType = this.passwordFieldType === "password" ? "text" : "password" this.passwordFieldType = this.passwordFieldType === "password" ? "text" : "password"
}, },
clearContent(name, e) { clearContent(name, { target }) {
switch (name) { switch (name) {
case "auth": case "auth":
this.auth = "None" this.auth = "None"
@@ -2491,12 +2487,12 @@ export default {
this.testReports = null this.testReports = null
break break
default: default:
;(this.label = ""), this.method = "GET"
(this.method = "GET"), this.url = "https://httpbin.org"
(this.url = "https://httpbin.org"), this.path = "/get"
(this.auth = "None"), this.uri = this.url + this.path
(this.path = "/get"), this.label = ""
(this.auth = "None") this.auth = "None"
this.httpUser = "" this.httpUser = ""
this.httpPassword = "" this.httpPassword = ""
this.bearerToken = "" this.bearerToken = ""
@@ -2515,11 +2511,11 @@ export default {
this.scope = "" this.scope = ""
this.files = [] this.files = []
} }
e.target.innerHTML = this.doneButton target.innerHTML = this.doneButton
this.$toast.info(this.$t("cleared"), { this.$toast.info(this.$t("cleared"), {
icon: "clear_all", icon: "clear_all",
}) })
setTimeout(() => (e.target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000) setTimeout(() => (target.innerHTML = '<i class="material-icons">clear_all</i>'), 1000)
}, },
saveRequest() { saveRequest() {
if (!this.checkCollections()) { if (!this.checkCollections()) {