nl_tokens: Middleware constructor function
pl_tokens: function consul ( options , resilient ) { defineResilientOptions ( params , <mask> ) return { // Incoming traffic middleware 'in' : function inHandler ( err , res , next ) { if ( err ) return next ( ) // resilient.js sometimes calls the middleware function more than once, with the output // of the previous invokation; checking here the type of the items in the response to // only call `mapServers` with service objects, not URLs (strings) if ( Array . isArray ( res . data ) && Object ( res . data [ 0 ] ) === res . data [ 0 ] ) { res . data = mapServers ( res . data ) } next ( ) } , // Outgoing traffic middleware 'out' : function outHandler ( options , next ) { options . params = options . params || { } if ( params . datacenter ) { options . params . dc = params . datacenter } if ( params . onlyHealthy ) { options . params . passing = true } if ( params . tag ) { options . params . tag = params . tag } next ( ) } } }