Skip to content

Commit f617c3b

Browse files
authored
Merge pull request #68 from craftship/fix-yarn-no-referer
Yarn: Fix No Referer Header
2 parents 5871a36 + 1570de4 commit f617c3b

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)