chg: [UI] Do not convert body template to string

pull/8269/head
Jakub Onderka 2022-04-10 12:09:43 +02:00
parent b5e59446ce
commit 2992830ee4
2 changed files with 6 additions and 5 deletions

View File

@ -415,7 +415,7 @@ class RestResponseComponent extends Component
}
}
}
$data['body'] = json_encode($body, JSON_PRETTY_PRINT);
$data['body'] = $body;
$url = '/' . $admin_routing . $controller . '/' . $action;
$data['url'] = $url;
if (!empty($data['params'])) {

View File

@ -81,7 +81,7 @@ function toggleRestClientBookmark() {
function removeRestClientHistoryItem(id) {
$.ajax({
data: '[]',
success:function (data, textStatus) {
success: function () {
populate_rest_history('bookmark');
populate_rest_history('history');
},
@ -161,7 +161,7 @@ var debounceTimerUpdate;
}
});
$('#TemplateSelect').change(function(e) {
$('#TemplateSelect').change(function() {
var selected_template = $('#TemplateSelect').val();
var previously_selected_template = $('#ServerUrl').data('urlWithoutParam')
if (selected_template !== '' && allValidApis[selected_template] !== undefined) {
@ -174,8 +174,9 @@ var debounceTimerUpdate;
var body_changed = allValidApis[previously_selected_template] !== undefined ? allValidApis[previously_selected_template].body != body_value : true;
var refreshBody = (body_value === '' || (server_url_changed && !body_changed))
if (refreshBody) {
$('#ServerBody').val(allValidApis[selected_template].body);
cm.setValue(allValidApis[selected_template].body)
var body = JSON.stringify(allValidApis[selected_template].body, null, 4);
$('#ServerBody').val(body);
cm.setValue(body)
}
setApiInfoBox(false);
updateQueryTool(selected_template, refreshBody);