2016-09-17 3 views
0

NetworkInterfaceのafterwareにあるさまざまなタイプのエラーをチェックしようとする簡単な考えがあります。のは、私はその目的のためにresponse.codeを使用することができないと仮定しましょう、私は体にアクセスする必要があります。AppoloStack NetworkInterface AfterWare

networkInterface.useAfter([{ 
    applyAfterware({ response }, next) { 
     // need to access response.body here 
     next(); 
    } 
}]); 

しかし、それは使用するresponse.bodyが利用できていないので、に別の方法があるはずのように、私は考え出しそれを行う?

答えて

0

私は、これは古いですけど、私は、レスポンスオブジェクトがfetch responseであると信じているので、あなたのようなものだろう:

networkInterface.useAfter([{ 
    applyAfterware({ response }, next) { 
     // Assuming body is a JSON object, see link for other methods 
     response.json().then(function(body) { 
      // Work with the body here 
      next(); 
     }); 
    } 
}]); 
関連する問題