mirror of
https://github.com/mountain-loop/yaak.git
synced 2026-11-21 07:51:39 +01:00
Detect JSON APIs returning HTML content-type
This commit is contained in:
1 parent
0d20e0fe29
commit
f8936e7b76
5 files changed
+66
-21
No files matched your search
@@ -14,3 +14,12 @@ export function languageFromContentType(contentType: string | null): EditorProps
|
||||
return 'text';
|
||||
}
|
||||
}
|
||||
|
||||
export function isJSON(text: string): boolean {
|
||||
try {
|
||||
JSON.parse(text);
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user