return new Observable(observer => { const key = operation.toKey(); const query = key.slice(0, key.length - ‘|{}| null'.length); fetch(url, { method: 'POST', headers: { 'content-type': 'application/json', }, body: JSON.stringify({ operationName: operation.operationName, variables: operation.variables, query, }), }) .then(res => res.json()) .then(json => observer.next(json)) .catch(json => observer.error(json)) .finally(() => observer.complete()); }); });