fix: improve parsing of authentication details in digest interceptor

This commit is contained in:
Pragadesh-45
2024-12-24 15:37:59 +05:30
parent fec99f0780
commit 26daee5d98

View File

@@ -45,9 +45,15 @@ function addDigestInterceptor(axiosInstance, request) {
console.debug(error.response.headers['www-authenticate']);
const authDetails = error.response.headers['www-authenticate']
.split(', ')
.map((v) => v.split('=').map(stripQuotes))
.reduce((acc, [key, value]) => ({ ...acc, [key]: value }), {});
.split(',')
.map((pair) => pair.split('=').map((item) => item.trim()).map(stripQuotes))
.reduce((acc, [key, value]) => {
if (key && value !== undefined) {
acc[key] = value;
}
return acc;
}, {});
console.debug(authDetails);
const nonceCount = '00000001';