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

This commit is contained in:
Leonardo Matos
2020-03-21 23:31:56 -03:00
parent 90bd8d45b4
commit 76786f7a01

View File

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