mirror of
https://github.com/usebruno/bruno.git
synced 2024-11-26 01:44:05 +01:00
Use the body to check for a json content type
This commit is contained in:
parent
76a26b634d
commit
dc32d7246c
@ -37,7 +37,7 @@ const formatResponse = (data, mode) => {
|
|||||||
|
|
||||||
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 formattedData = formatResponse(data, mode);
|
const formattedData = formatResponse(data, mode);
|
||||||
const { storedTheme } = useTheme();
|
const { storedTheme } = useTheme();
|
||||||
|
|
||||||
|
@ -43,7 +43,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…
Reference in New Issue
Block a user