Skip to content

Commit 1570de4

Browse files
committed
Yarn does not send a Referer header
1 parent 5871a36 commit 1570de4

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

src/contextFactory.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,12 +8,19 @@ const user = authorizer => ({
88
});
99

1010
const command = (headers) => {
11-
const refererParts = headers.Referer.split(' ');
12-
const name = refererParts[0];
11+
if (headers.Referer) {
12+
const refererParts = headers.Referer.split(' ');
13+
const name = refererParts[0];
14+
15+
return {
16+
name,
17+
args: refererParts.slice(1),
18+
};
19+
}
1320

1421
return {
15-
name,
16-
args: refererParts.slice(1),
22+
name: 'Unknown',
23+
args: [],
1724
};
1825
};
1926

0 commit comments

Comments
 (0)