J'utilise fetch.js (https://github.com/github/fetch) pour envoyer un objet json relativement grand au backend. Le json est grand en ce qu'il inclut une chaîne d'image SVG.Activation de la compression gzip avec fetch.js
Je ne sais pas si fetch.js utilise la compression gzip par défaut, ou si j'ai besoin de compresser manuellement et d'ajouter des en-têtes. Toute aide serait appréciée.
return new Promise((resolve, reject) => { fetch(api_base + "/api/save-photo", { method: 'POST', mode : 'cors', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(payload) }) .then((response) => { if (response.status === 404) { throw new Error('404 (Not Found)'); } else { return response.json().then((json) => { console.log('save poster response: ', json); return json; }); } })