Skip to content

Commit

Permalink
Always serve the demo-app html
Browse files Browse the repository at this point in the history
  • Loading branch information
huntharo committed Oct 26, 2022
1 parent 9498c9d commit 12a2774
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions packages/demo-app/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,17 +11,6 @@ export async function handler(
// eslint-disable-next-line @typescript-eslint/no-unused-vars
context?: lambda.Context,
): Promise<unknown> {
if (event.rawPath === '/demo-app') {
return {
statusCode: 200,
headers: {
'Content-Type': 'text/html',
},
isBase64Encoded: false,
body: html,
};
}

if (event.rawPath.endsWith('/serverIncrement')) {
const currValue = parseInt(event.queryStringParameters?.currValue ?? '0', 10);
const newValue = currValue + 1;
Expand All @@ -40,6 +29,17 @@ export async function handler(
};
}

if (event.headers?.accept && event.headers.accept.includes('text/html')) {
return {
statusCode: 200,
headers: {
'Content-Type': 'text/html',
},
isBase64Encoded: false,
body: html,
};
}

return {
source: 'demo-app',
timestamp: `${new Date().toUTCString()}`,
Expand Down

0 comments on commit 12a2774

Please sign in to comment.