In what text format? I tried only secret value, VALUE=SECRET, etc
In what text format? I tried only secret value, VALUE=SECRET, etc
wrangler secret put CALLS_APP_SECRET you dont need to specify the value in the command. you will write the value when it asks for the secret value/ is marked as a document, /abc.js is marked as js)
Does returning response with status code 500 automatically send this page?Nope
fetch Responses within a Worker?node_compat involves bundling polyfills into your Worker. nodejs_compat are native Node-ish modules that you can use without changes to your Worker itself. Wherever possible, we recommend the compat flag, but some packages require node_compat insteadcontent-length off
request.headers.get('Authorization')wrangler secret put CALLS_APP_SECRET/abc.jscontent-lengthrequest.headers.get('Authorization')async fetch(request: Request, env, ctx) {
if (request.method === 'POST') {
console.log("Request headers: ")
console.log(JSON.stringify(request.headers));
if (request.headers['Authorization']) {
const auth: string = request.headers['Authorization'];
const authRegex = /Bearer (\w+)/g;
const match = auth.match(authRegex);
if (match) {
// do stuff
}
} else {
return new Request("Unauthorized request", {status:403});
}
}