Relative Content

Tag Archive for javascriptfetch

Fetch gzipped json using just fetch json.gz

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 […]

Javascript Fetch Get doesn’t show data

I have a MCU with a small website. Now I want use FETCH for getting live data from it.
It works fine, but one PC (with different browsers) don’t show the values.
In wireshark I see the right communication, but the browser dont get the received data.

Use a get method with body using fetch

I have this serverless function, which acts like a proxy on Digital Ocean. The problem I’m encountering is that when I use fetch, I need to include a body. Without a body, I receive a 500 error. This setup works in Postman, but it doesn’t work in Node 18