Open timt-unity3d opened 7 years ago
I'm overriding the send function to use oboe to allow streaming processing of batches as they are returned from the server. This allows me to override the base send function and decorate the standard nodeJsMultiFetchAdapter like so:
angular .module('shared.adapter', ['jcs.angular-http-batch']) .decorator('nodeJsMultiFetchAdapter', function($delegate) { $delegate.send = function() { var self = this, adapter = self.getAdapter(), httpBatchConfig = adapter.buildRequest(self.requests, self.config); self.sendCallback(); httpBatchConfig.withCredentials = true; oboe(httpBatchConfig) .node('!.*', function(node, path) { if (self.requests[path]) { self.requests[path].callback( node.statusCode, node.body, convertHeadersToString(node.headers), node.statusText ); } }); }; return $delegate; });
I'm overriding the send function to use oboe to allow streaming processing of batches as they are returned from the server. This allows me to override the base send function and decorate the standard nodeJsMultiFetchAdapter like so: