UNPKG

305 BJavaScriptView Raw
1'use strict';
2
3var re = /(\S+)\s+(\S+)/;
4
5
6
7function parseAuthHeader(hdrValue) {
8 if (typeof hdrValue !== 'string') {
9 return null;
10 }
11 var matches = hdrValue.match(re);
12 return matches && { scheme: matches[1], value: matches[2] };
13}
14
15
16
17module.exports = {
18 parse: parseAuthHeader
19};