Skip to content

Commit 74164c5

Browse files
committed
Handle redirects in other routes
1 parent 4275409 commit 74164c5

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

handler/index.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* 301 permanently redirect /index requests to /graphql
33
*/
44
export const handler = async function(event) {
5+
if (req.httpMethod === 'OPTIONS') {
6+
return { statusCode: 200 }
7+
}
58
let location = '/graphql';
69
if (event.queryStringParameters) {
710
location += '?' + new URLSearchParams(event.queryStringParameters);

handler/swapi.mjs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
* 301 permanently redirect /swapi requests to /graphql
33
*/
44
export const handler = async function(event) {
5+
if (req.httpMethod === 'OPTIONS') {
6+
return { statusCode: 200 }
7+
}
58
let location = '/graphql';
69
if (event.queryStringParameters) {
710
location += '?' + new URLSearchParams(event.queryStringParameters);

0 commit comments

Comments
 (0)