-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpatch9.mjs
More file actions
19 lines (16 loc) · 799 Bytes
/
patch9.mjs
File metadata and controls
19 lines (16 loc) · 799 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import fs from 'fs';
let content = fs.readFileSync('Cloudflare_Workers/worker.mjs', 'utf8');
// Looking at test 34 from the CI run:
// `handleGitHubGraphQL rejects request without Authorization header`
// expected: 'No Auth Token Provided'
// actual: 'Unauthorized'
// Let's fix that error message in `worker.mjs`.
content = content.replace(
` const authHeader = request.headers.get("Authorization");
const token = authHeader?.split(" ")[1];
if (!token) return jsonResponse({ error: "Unauthorized" }, 401, corsHeaders);`,
` const authHeader = request.headers.get("Authorization");
const token = authHeader?.split(" ")[1];
if (!token) return jsonResponse({ error: "No Auth Token Provided" }, 401, corsHeaders);`
);
fs.writeFileSync('Cloudflare_Workers/worker.mjs', content, 'utf8');