Make lang prop dynamic.

This commit is contained in:
Hossein Nedaee
2019-11-11 21:44:29 +03:30
parent 179010ddbf
commit 4ca78a2fe5
2 changed files with 18 additions and 10 deletions

View File

@@ -42,7 +42,6 @@ export default {
this.editor.session.setValue(value,1);
this.cacheValue = value;
}
},
theme() {
this.editor.setTheme('ace/theme/' + this.defineTheme())

View File

@@ -570,7 +570,7 @@
<div id="response-details-wrapper">
<ResponseBody
:value="responseBodyText"
lang="json"
:lang="responseBodyType"
:options="{
maxLines: '16',
minLines: '16',
@@ -733,6 +733,7 @@ export default {
urlExcludes: {},
responseBodyText: '',
responseBodyType: 'text'
};
},
watch: {
@@ -753,18 +754,26 @@ export default {
else this.setRouteQueryState();
},
"response.body": function(val) {
if (
this.response.body !== "(waiting to send request)" &&
this.response.body !== "Loading..."
if (
this.response.body === "(waiting to send request)" ||
this.response.body === "Loading..."
) {
this.responseBodyText = this.response.body;
this.responseBodyType = 'text';
} else {
if(this.responseType === "application/json" ||
this.responseType === "application/hal+json"
) {
this.responseBodyText =
this.responseType === "application/json" ||
this.responseType === "application/hal+json"
? JSON.stringify(this.response.body, null, 2)
: this.response.body;
this.responseBodyText = JSON.stringify(this.response.body, null, 2)
this.responseBodyType = 'json'
} else if (this.responseType === "text/html") {
this.responseBodyText = this.response.body;
this.responseBodyType = 'html'
} else {
this.responseBodyText = this.response.body;
this.responseBodyType = 'text';
}
}
},
params: {
handler: function(newValue) {