File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -51,11 +51,12 @@ export default function couchdbAuthProxy(fn, opts={}) {
51
51
// inject couchdb proxy headers into request
52
52
const ctx = await confusedAsync ( fn , null , [ req , res ] ) ;
53
53
if ( ctx != null ) {
54
- cleanHeaders ( req , Object . values ( headerFields ) ) ;
54
+ const { username, roles, token } = headerFields ;
55
+ cleanHeaders ( req , [ username , roles , token ] ) ;
55
56
const n = typeof ctx . name === "string" ? ctx . name : "" ;
56
- req . headers [ headerFields . username ] = n ;
57
- req . headers [ headerFields . roles ] = Array . isArray ( ctx . roles ) ? ctx . roles . join ( "," ) : "" ;
58
- if ( secret ) req . headers [ headerFields . token ] = sign ( n , secret ) ;
57
+ req . headers [ username ] = n ;
58
+ req . headers [ roles ] = Array . isArray ( ctx . roles ) ? ctx . roles . join ( "," ) : "" ;
59
+ if ( secret ) req . headers [ token ] = sign ( n , secret ) ;
59
60
}
60
61
61
62
proxy . web ( req , res ) ;
You can’t perform that action at this time.
0 commit comments