mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
Revert "Frontend: Use safe stringifier in parseBody" (#90522)
Revert "Frontend: Use safe stringifier in parseBody (#90047)"
This reverts commit 434f386982
.
This commit is contained in:
parent
8f376a302b
commit
3559c5c297
@ -246,7 +246,7 @@ export {
|
||||
} from './utils/csv';
|
||||
export { parseLabels, findCommonLabels, findUniqueLabels, matchAllLabels, formatLabels } from './utils/labels';
|
||||
export { roundDecimals, guessDecimals } from './utils/numbers';
|
||||
export { objRemoveUndefined, isEmptyObject, safeStringifyValue } from './utils/object';
|
||||
export { objRemoveUndefined, isEmptyObject } from './utils/object';
|
||||
export { classicColors } from './utils/namedColorsPalette';
|
||||
export { getSeriesTimeStep, hasMsResolution } from './utils/series';
|
||||
export { BinaryOperationID, type BinaryOperation, binaryOperators } from './utils/binaryOperators';
|
||||
|
@ -10,22 +10,3 @@
|
||||
export const isEmptyObject = (value: unknown): value is Record<string, never> => {
|
||||
return typeof value === 'object' && value !== null && Object.keys(value).length === 0;
|
||||
};
|
||||
|
||||
/** Stringifies an object that may contain circular references */
|
||||
export function safeStringifyValue(value: unknown) {
|
||||
const getCircularReplacer = () => {
|
||||
const seen = new WeakSet();
|
||||
return (_: string, value: object | null) => {
|
||||
if (typeof value === 'object' && value !== null) {
|
||||
if (seen.has(value)) {
|
||||
return;
|
||||
}
|
||||
seen.add(value);
|
||||
}
|
||||
|
||||
return value;
|
||||
};
|
||||
};
|
||||
|
||||
return JSON.stringify(value, getCircularReplacer());
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import { omitBy } from 'lodash';
|
||||
|
||||
import { deprecationWarning, safeStringifyValue } from '@grafana/data';
|
||||
import { deprecationWarning } from '@grafana/data';
|
||||
import { BackendSrvRequest } from '@grafana/runtime';
|
||||
|
||||
export const parseInitFromOptions = (options: BackendSrvRequest): RequestInit => {
|
||||
@ -93,7 +93,7 @@ export const parseBody = (options: BackendSrvRequest, isAppJson: boolean) => {
|
||||
return options.data;
|
||||
}
|
||||
|
||||
return isAppJson ? safeStringifyValue(options.data) : new URLSearchParams(options.data);
|
||||
return isAppJson ? JSON.stringify(options.data) : new URLSearchParams(options.data);
|
||||
};
|
||||
|
||||
export async function parseResponseBody<T>(
|
||||
|
Loading…
Reference in New Issue
Block a user