Can not set Header in KOA When using callback
问题 Recently I worked on a new project that used javascript callbacks. And I was using koa framework. But when I called this route : function * getCubes(next) { var that = this; _OLAPSchemaProvider.LoadCubesJSon(function(result) { that.body = JSON.stringify(result.toString()); }); } I get this error : _http_outgoing.js:331 throw new Error('Can\'t set headers after they are sent.'); ^ Error: Can't set headers after they are sent. at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:331