Я использую fetch polyfill для извлечения JSON или текста из URL-адреса, я хочу знать, как проверить, является ли ответ объектом JSON, или это только текст
fetch(URL, options).then(response => {
// how to check if response has a body of type json?
if (response.isJson()) return response.json();
});