Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing const keyword #9

Open
fulopkovacs opened this issue Aug 11, 2023 · 0 comments
Open

Missing const keyword #9

fulopkovacs opened this issue Aug 11, 2023 · 0 comments

Comments

@fulopkovacs
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant