Skip to content

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

fix(raw-input): allow list parameters for json, set true when raw params is changed

Leonardo Matos76786f7a0187
diff --git a/pages/index.vue b/pages/index.vue
index 89b432856..a594af062 100644
--- a/pages/index.vue
+++ b/pages/index.vue
@@ -1435,7 +1435,13 @@ export default {
canListParameters: {
immediate: true,
handler(canListParameters) {
- this.rawInput = !canListParameters
+ if (canListParameters) {
+ this.$nextTick(() => {
+ this.rawInput = Boolean(this.rawParams && this.rawParams !== "{}")
+ })
+ } else {
+ this.rawInput = true
+ }
},
},
contentType(contentType, oldContentType) {
@@ -1530,11 +1536,6 @@ export default {
},
},
computed: {
- /**
- * These are content types that can be automatically
- * serialized by postwoman.
- */
- knownContentTypes: () => ["application/json", "application/x-www-form-urlencoded"],
/**
* These are a list of Content Types known to Postwoman.
*/
@@ -1546,8 +1547,12 @@ export default {
"text/html",
"text/plain",
],
+ /**
+ * Check content types that can be automatically
+ * serialized by postwoman.
+ */
canListParameters() {
- return this.contentType === "application/x-www-form-urlencoded"
+ return ["application/json", "application/x-www-form-urlencoded"].includes(this.contentType)
},
uri: {
get() {
@@ -1764,7 +1769,7 @@ export default {
},
rawInput: {
get() {
- return this.canListParameters ? this.$store.state.request.rawInput : true
+ return this.$store.state.request.rawInput
},
set(value) {
this.$store.commit("setState", { value, attribute: "rawInput" })