@@ -73,7 +73,7 @@ async function fastifyBasicAuth (fastify, opts) {
7373 const strictCredentials = opts . strictCredentials ?? true
7474 const useUtf8 = opts . utf8 ?? true
7575 const charset = useUtf8 ? 'utf-8' : 'ascii'
76- const authenticateHeader = getAuthenticateHeader ( opts . authenticate , useUtf8 )
76+ const authenticateHeader = getAuthenticateHeaders ( opts . authenticate , useUtf8 )
7777 const header = opts . header ?. toLowerCase ( ) || 'authorization'
7878
7979 const credentialsRE = strictCredentials
@@ -132,7 +132,7 @@ async function fastifyBasicAuth (fastify, opts) {
132132 if ( err . statusCode === 401 ) {
133133 const header = authenticateHeader ( req )
134134 if ( header ) {
135- reply . header ( ... header )
135+ reply . header ( header [ 0 ] , header [ 1 ] )
136136 }
137137 }
138138 next ( err )
@@ -143,7 +143,7 @@ async function fastifyBasicAuth (fastify, opts) {
143143 }
144144}
145145
146- function getAuthenticateHeader ( authenticate , useUtf8 ) {
146+ function getAuthenticateHeaders ( authenticate , useUtf8 ) {
147147 const defaultHeaderName = 'WWW-Authenticate'
148148 if ( ! authenticate ) return ( ) => false
149149 if ( authenticate === true ) {
0 commit comments