forked from extern/bruno
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);
|
||||
}
|
||||
|
||||
if (['text', 'html'].includes(mode) || typeof data === 'string') {
|
||||
if (typeof data === 'string') {
|
||||
return data;
|
||||
}
|
||||
|
||||
@ -48,7 +48,7 @@ const formatResponse = (data, mode, filter) => {
|
||||
|
||||
const QueryResult = ({ item, collection, data, dataBuffer, width, disableRunEventListener, headers, error }) => {
|
||||
const contentType = getContentType(headers);
|
||||
const mode = getCodeMirrorModeBasedOnContentType(contentType);
|
||||
const mode = getCodeMirrorModeBasedOnContentType(contentType, data);
|
||||
const [filter, setFilter] = useState(null);
|
||||
const formattedData = formatResponse(data, mode, filter);
|
||||
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') {
|
||||
return 'application/text';
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user