115
rated 0 times
[
122]
[
7]
/ answers: 1 / hits: 143941
/ 8 Years ago, mon, may 9, 2016, 12:00:00
I'm using fetch polyfill to retrieve a JSON or text from a URL, I want to know how can I check if the response is a JSON object or is it only text
fetch(URL, options).then(response => {
// how to check if response has a body of type json?
if (response.isJson()) return response.json();
});
More From » json