tylermwashburn/trailer — Issue #9: Improved api/redirect delegation code.
Author: tylermwashburn
Created: 2011-12-04 17:21:23+00:00
State: open

if ( i.conf.api && Function.is( i.conf.api[ i.up ] ) ) {
i.conf.api[ i.up ]( i, o, i.extra )
} else if ( i.conf.api && Function.is( i.conf.api[ i.extra ] ) ) {
i.conf.api[ i.extra ]( i, o, i.up )
} else if ( !i.depth && i.conf.redirect && i.conf.redirect[ i.url.pathname ] ) {
o.extend( { "Location": i.conf.redirect[ i.url.pathname ] } )
.error( 307 )
} else {

This part of the code looks really bad, and is hard to work with when extending.