fix(req-body): fix preseting default body (raw) by content type
This commit is contained in:
@@ -1435,12 +1435,25 @@ export default {
|
|||||||
canListParameters(canToggleRaw) {
|
canListParameters(canToggleRaw) {
|
||||||
this.rawInput = !canToggleRaw
|
this.rawInput = !canToggleRaw
|
||||||
},
|
},
|
||||||
rawInput(status) {
|
contentType(contentType) {
|
||||||
if (status && this.rawParams === "") {
|
switch (contentType) {
|
||||||
this.rawParams = "{}"
|
case "application/json":
|
||||||
} else {
|
case "application/hal+json":
|
||||||
this.setRouteQueryState()
|
if (!(this.rawParams.charAt(0) in ['"', "{", "["])) {
|
||||||
|
this.rawParams = "{}"
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "application/xml":
|
||||||
|
if (this.rawParams.charAt(0) !== "<" || this.rawParams === "<!doctype html>") {
|
||||||
|
this.rawParams = "<?xml version='1.0' encoding='utf-8'?>"
|
||||||
|
}
|
||||||
|
break
|
||||||
|
case "text/html":
|
||||||
|
if (this.rawParams.charAt(0) !== "<" || this.rawParams.startsWith("<?xml")) {
|
||||||
|
this.rawParams = "<!doctype html>"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
this.setRouteQueryState()
|
||||||
},
|
},
|
||||||
"response.body": function(val) {
|
"response.body": function(val) {
|
||||||
if (
|
if (
|
||||||
|
|||||||
Reference in New Issue
Block a user