fetch('./data.json.gz',{"Content-Encoding": "gzip" , "Content-Type": "application/json"})
.then(response => response.json())
.then(data => console.log(data))
.catch(err => console.log(err));
result:
SyntaxError: The string did not match the expected pattern.
data.json:
{
"data":1
}
and it was gzipped with gzip data.json
According to answer here this should work?
How to fetch json.gz in a modern browser without third-party libraries?
Is this possible – are my headers insufficient?