20 lines
305 B
JavaScript
20 lines
305 B
JavaScript
'use strict';
|
|
|
|
var re = /(\S+)\s+(\S+)/;
|
|
|
|
|
|
|
|
function parseAuthHeader(hdrValue) {
|
|
if (typeof hdrValue !== 'string') {
|
|
return null;
|
|
}
|
|
var matches = hdrValue.match(re);
|
|
return matches && { scheme: matches[1], value: matches[2] };
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
parse: parseAuthHeader
|
|
};
|