Skip to content

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

:rotating_light: Lint

Liyas Thomasc4c320da83e2
diff --git a/README.md b/README.md
index a521254bd..7eabf3c2a 100644
--- a/README.md
+++ b/README.md
@@ -157,9 +157,10 @@ _Collections are synced with local session storage_
**Features:**
- Hide your IP address
- Fixes [CORS](https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) (Cross Origin Resource Sharing) issues
- - Access APIs served in non-HTTPS (`http://`, `localhost`, etc.)
+ - Access APIs served in non-HTTPS (`http://`)
+ - Use custom Proxy URL
-_Proxy is hosted by ApolloTV - [Privacy policy](https://apollotv.xyz/legal)_
+_Official Postwoman Proxy is hosted by ApolloTV - [Privacy policy](https://apollotv.xyz/legal)_
📜 **Pre-Request Scripts**: Snippets of code associated with a request that are executed before the request is sent.
diff --git a/components/collections/folder.vue b/components/collections/folder.vue
index 29b4694cd..1443770b0 100644
--- a/components/collections/folder.vue
+++ b/components/collections/folder.vue
@@ -45,7 +45,8 @@
folderIndex,
requestIndex: index
})
- "/>
+ "
+ />
</li>
<li v-if="folder.requests.length === 0">
<label>Folder is empty</label>
diff --git a/components/history.vue b/components/history.vue
index f6762c6af..57820b608 100644
--- a/components/history.vue
+++ b/components/history.vue
@@ -236,23 +236,23 @@
<div class="flex-wrap" v-else>
<label for="clear-history-button">Are you sure?</label>
<div>
- <button
- class="icon"
- id="confirm-clear-history-button"
- @click="clearHistory"
- v-tooltip="'Yes'"
- >
- <i class="material-icons">done</i>
- </button>
- <button
- class="icon"
- id="reject-clear-history-button"
- @click="disableHistoryClearing"
- v-tooltip="'No'"
- >
- <i class="material-icons">close</i>
- </button>
- </div>
+ <button
+ class="icon"
+ id="confirm-clear-history-button"
+ @click="clearHistory"
+ v-tooltip="'Yes'"
+ >
+ <i class="material-icons">done</i>
+ </button>
+ <button
+ class="icon"
+ id="reject-clear-history-button"
+ @click="disableHistoryClearing"
+ v-tooltip="'No'"
+ >
+ <i class="material-icons">close</i>
+ </button>
+ </div>
</div>
</div>
</pw-section>
diff --git a/pages/graphql.vue b/pages/graphql.vue
index 3c1494463..89552ca39 100644
--- a/pages/graphql.vue
+++ b/pages/graphql.vue
@@ -86,7 +86,7 @@
@click="removeRequestHeader(index)"
id="header"
>
- <i class="material-icons">delete</i>
+ <i class="material-icons">delete</i>
</button>
</li>
</div>
@@ -232,7 +232,7 @@
<script>
import axios from "axios";
import * as gql from "graphql";
-import textareaAutoHeight from '../directives/textareaAutoHeight';
+import textareaAutoHeight from "../directives/textareaAutoHeight";
import AceEditor from "../components/ace-editor";
export default {
@@ -310,13 +310,12 @@ export default {
this.$nuxt.$loading.start();
try {
-
const query = JSON.stringify({
query: gql.getIntrospectionQuery()
});
let headers = {};
- this.headers.forEach((header) => {
+ this.headers.forEach(header => {
headers[header.key] = header.value;
});
@@ -328,19 +327,20 @@ export default {
"content-type": "application/json"
},
data: query
- }
+ };
- console.log(reqOptions);
+ // console.log(reqOptions);
const reqConfig = this.$store.state.postwoman.settings.PROXY_ENABLED
? {
- method: "post",
- url: `https://postwoman.apollotv.xyz/`,
- data: reqOptions
- }
+ method: "post",
+ url:
+ this.$store.state.postwoman.settings.PROXY_URL ||
+ `https://postwoman.apollotv.xyz/`,
+ data: reqOptions
+ }
: reqOptions;
-
const res = await axios(reqConfig);
const data = this.$store.state.postwoman.settings.PROXY_ENABLED
@@ -421,20 +421,19 @@ export default {
},
ToggleExpandResponse() {
this.expandResponse = !this.expandResponse;
- this.responseBodyMaxLines = (this.responseBodyMaxLines == Infinity) ? 16 : Infinity;
+ this.responseBodyMaxLines =
+ this.responseBodyMaxLines == Infinity ? 16 : Infinity;
},
downloadResponse() {
- const dataToWrite = JSON.stringify(this.schemaString, null, 2)
+ const dataToWrite = JSON.stringify(this.schemaString, null, 2);
const file = new Blob([dataToWrite], { type: "application/json" });
const a = document.createElement("a"),
url = URL.createObjectURL(file);
a.href = url;
- a.download = (
- this.url +
- " on " +
- Date() +
- ".graphql"
- ).replace(/\./g, "[dot]");
+ a.download = (this.url + " on " + Date() + ".graphql").replace(
+ /\./g,
+ "[dot]"
+ );
document.body.appendChild(a);
a.click();
this.$refs.downloadResponse.innerHTML = this.doneButton;
diff --git a/pages/index.vue b/pages/index.vue
index a683fcc2c..2c5ff273b 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -599,7 +599,9 @@
: 'Collapse response'
}"
>
- <i class="material-icons" v-if="!expandResponse">unfold_more</i>
+ <i class="material-icons" v-if="!expandResponse"
+ >unfold_more</i
+ >
<i class="material-icons" v-else>unfold_less</i>
</button>
<button
@@ -1231,7 +1233,7 @@ export default {
);
}
if (this.headers) {
- this.headers.forEach((element) => {
+ this.headers.forEach(element => {
requestString.push(
"xhr.setRequestHeader('" +
element.key +
@@ -1288,7 +1290,7 @@ export default {
);
}
if (this.headers) {
- this.headers.forEach((element) => {
+ this.headers.forEach(element => {
headers.push(
' "' + element.key + '": "' + element.value + '",\n'
);
@@ -1326,7 +1328,7 @@ export default {
);
}
if (this.headers) {
- this.headers.forEach((element) => {
+ this.headers.forEach(element => {
requestString.push(
" -H '" + element.key + ": " + element.value + "' \\\n"
);
@@ -1412,7 +1414,9 @@ export default {
const config = this.$store.state.postwoman.settings.PROXY_ENABLED
? {
method: "POST",
- url: this.$store.state.postwoman.settings.PROXY_URL || "https://postwoman.apollotv.xyz/",
+ url:
+ this.$store.state.postwoman.settings.PROXY_URL ||
+ "https://postwoman.apollotv.xyz/",
data: requestOptions
}
: requestOptions;
@@ -1702,7 +1706,8 @@ export default {
},
ToggleExpandResponse() {
this.expandResponse = !this.expandResponse;
- this.responseBodyMaxLines = (this.responseBodyMaxLines == Infinity) ? 16 : Infinity;
+ this.responseBodyMaxLines =
+ this.responseBodyMaxLines == Infinity ? 16 : Infinity;
},
copyResponse() {
this.$refs.copyResponse.innerHTML = this.doneButton;
diff --git a/pages/realtime.vue b/pages/realtime.vue
index 8b2a15892..84905ab32 100644
--- a/pages/realtime.vue
+++ b/pages/realtime.vue
@@ -52,7 +52,9 @@
v-for="(logEntry, index) in communication.log"
:style="{ color: logEntry.color }"
:key="index"
- >@ {{ logEntry.ts }} {{ getSourcePrefix(logEntry.source) }} {{ logEntry.payload }}</span>
+ >@ {{ logEntry.ts }}{{ getSourcePrefix(logEntry.source)
+ }}{{ logEntry.payload }}</span
+ >
</span>
<span v-else>(waiting for connection)</span>
</div>
@@ -115,7 +117,9 @@
>
{{ toggleSSEConnectionVerb }}
<span>
- <i class="material-icons" v-if="!connectionSSEState">sync</i>
+ <i class="material-icons" v-if="!connectionSSEState"
+ >sync</i
+ >
<i class="material-icons" v-if="connectionSSEState"
>sync_disabled</i
>
@@ -140,7 +144,9 @@
v-for="(logEntry, index) in events.log"
:style="{ color: logEntry.color }"
:key="index"
- >@ {{ logEntry.ts }} {{ getSourcePrefix(logEntry.source) }} {{ logEntry.payload }}</span>
+ >@ {{ logEntry.ts }}{{ getSourcePrefix(logEntry.source)
+ }}{{ logEntry.payload }}</span
+ >
</span>
<span v-else>(waiting for connection)</span>
</div>
@@ -355,7 +361,7 @@ export default {
color: "var(--ac-color)"
}
];
- if(typeof(EventSource) !== "undefined") {
+ if (typeof EventSource !== "undefined") {
try {
this.sse = new EventSource(this.server);
this.sse.onopen = event => {
diff --git a/pages/settings.vue b/pages/settings.vue
index fbefe2c79..04ea0bf5f 100644
--- a/pages/settings.vue
+++ b/pages/settings.vue
@@ -82,7 +82,16 @@
</ul>
<ul>
<li>
- <label for="url">URL</label>
+ <div class="flex-wrap">
+ <label for="url">URL</label>
+ <button
+ class="icon"
+ @click="settings.PROXY_URL = `https://postwoman.apollotv.xyz/`"
+ v-tooltip.bottom="'Reset to default'"
+ >
+ <i class="material-icons">clear_all</i>
+ </button>
+ </div>
<input id="url" type="url" v-model="settings.PROXY_URL" :disabled="!settings.PROXY_ENABLED">
</li>
</ul>