Created
January 29, 2025 02:52
-
-
Save purplecabbage/c9c65246da00fade7ab89e78b8f380ba to your computer and use it in GitHub Desktop.
Revisions
-
purplecabbage created this gist
Jan 29, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,23 @@ async function main (params) { console.log('params?.__ow_headers?.cookie =', params?.__ow_headers?.cookie) let newValue = params?.__ow_headers?.cookie?.split('=')[1] || 0 return { statusCode:200, headers: { 'Content-Type': 'text/html', 'set-cookie': `mycookie=${parseInt(newValue) + 1}; Secure; HttpOnly; SameSite=Strict` }, body: `<!DOCTYPE html> <html> <head> <title>Example</title> </head> <body> <h1>Hello, world!</h1> <pre>${JSON.stringify(params, null, 2)}</pre> </body> </html>` } } exports.main = main