johnpaulada
3/27/2017 - 9:42 AM

Get response body as text in Apollo client.

Get response body as text in Apollo client.

networkInterface.useAfter([{
  applyAfterware({ response }, next) {
    const reader = new FileReader();
    
    // Process text after being read
    reader.addEventListener('loadend', (e) => {
      console.log(e.srcElement.result);
    });
    
    // Start reading text from response blob
    reader.readAsText(response._bodyBlob);
    
    next();
  }
}]);