mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
feat(inspector): fixed error handling, showing response body when data proxy returns text/html body
This commit is contained in:
parent
58df60f670
commit
a5f0f508ea
@ -7,7 +7,7 @@ define([
|
||||
function (angular, _, $, coreModule) {
|
||||
'use strict';
|
||||
|
||||
coreModule.default.controller('InspectCtrl', function($scope) {
|
||||
coreModule.default.controller('InspectCtrl', function($scope, $sanitize) {
|
||||
var model = $scope.inspector;
|
||||
|
||||
function getParametersFromQueryString(queryString) {
|
||||
@ -32,7 +32,11 @@ function (angular, _, $, coreModule) {
|
||||
if (_.isString(model.error.data)) {
|
||||
$scope.response = $("<div>" + model.error.data + "</div>").text();
|
||||
} else if (model.error.data) {
|
||||
$scope.response = angular.toJson(model.error.data, true);
|
||||
if (model.error.data.response) {
|
||||
$scope.response = $sanitize(model.error.data.response);
|
||||
} else {
|
||||
$scope.response = angular.toJson(model.error.data, true);
|
||||
}
|
||||
} else if (model.error.message) {
|
||||
$scope.message = model.error.message;
|
||||
}
|
||||
|
@ -138,7 +138,8 @@ export class BackendSrv {
|
||||
//populate error obj on Internal Error
|
||||
if (_.isString(err.data) && err.status === 500) {
|
||||
err.data = {
|
||||
error: err.statusText
|
||||
error: err.statusText,
|
||||
response: err.data,
|
||||
};
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user