From 76786f7a0187e1509489dc1010e1776fe06b300b Mon Sep 17 00:00:00 2001 From: Leonardo Matos Date: Sat, 21 Mar 2020 23:31:56 -0300 Subject: [PATCH] fix(raw-input): allow list parameters for json, set true when raw params is changed --- pages/index.vue | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) 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" })