|
workerTemplate = """addEventListener('fetch', event => { |
|
event.respondWith(handleRequest(event.request)) |
|
}) |
|
async function handleRequest(request) { |
|
let authToken='<B2_DOWNLOAD_TOKEN>' |
|
let b2Headers = new Headers(request.headers) |
|
b2Headers.append("Authorization", authToken) |
|
modRequest = new Request(request.url, { |
|
method: request.method, |
|
headers: b2Headers |
|
}) |
|
const response = await fetch(modRequest) |
|
return response |
|
}""" |
The modRequest variable in line 76 is in the global scope, which shouldn't break the functionality of the worker, but in my opinion it'd be safer to make it local by putting a const keyword before it.
gists/b2AuthorizeCfWorker.py
Lines 69 to 82 in b5a73fe
The
modRequestvariable in line76is in the global scope, which shouldn't break the functionality of the worker, but in my opinion it'd be safer to make it local by putting aconstkeyword before it.