mirror of
https://github.com/usebruno/bruno.git
synced 2025-06-19 03:17:16 +02:00
Merge pull request #838 from Joschasa/feature/always-indent-json-in-queryresult
Feature/always indent json in queryresult
This commit is contained in:
commit
9f8dba0fb2
@ -39,7 +39,7 @@ const formatResponse = (data, mode, filter) => {
|
|||||||
return safeStringifyJSON(parsed, true);
|
return safeStringifyJSON(parsed, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (['text', 'html'].includes(mode) || typeof data === 'string') {
|
if (typeof data === 'string') {
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,7 +48,7 @@ const formatResponse = (data, mode, filter) => {
|
|||||||
|
|
||||||
const QueryResult = ({ item, collection, data, dataBuffer, width, disableRunEventListener, headers, error }) => {
|
const QueryResult = ({ item, collection, data, dataBuffer, width, disableRunEventListener, headers, error }) => {
|
||||||
const contentType = getContentType(headers);
|
const contentType = getContentType(headers);
|
||||||
const mode = getCodeMirrorModeBasedOnContentType(contentType);
|
const mode = getCodeMirrorModeBasedOnContentType(contentType, data);
|
||||||
const [filter, setFilter] = useState(null);
|
const [filter, setFilter] = useState(null);
|
||||||
const formattedData = formatResponse(data, mode, filter);
|
const formattedData = formatResponse(data, mode, filter);
|
||||||
const { storedTheme } = useTheme();
|
const { storedTheme } = useTheme();
|
||||||
|
@ -42,7 +42,10 @@ export const defineCodeMirrorBrunoVariablesMode = (variables, mode) => {
|
|||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
export const getCodeMirrorModeBasedOnContentType = (contentType) => {
|
export const getCodeMirrorModeBasedOnContentType = (contentType, body) => {
|
||||||
|
if (typeof body === 'object') {
|
||||||
|
return 'application/ld+json';
|
||||||
|
}
|
||||||
if (!contentType || typeof contentType !== 'string') {
|
if (!contentType || typeof contentType !== 'string') {
|
||||||
return 'application/text';
|
return 'application/text';
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user