Commit fe40f61 1 parent 1a3cbd4 commit fe40f61 Copy full SHA for fe40f61
File tree 2 files changed +8
-16
lines changed
auth-providers/dbAuth/api/src
2 files changed +8
-16
lines changed Original file line number Diff line number Diff line change @@ -47,21 +47,17 @@ export const parseFetchEventBody = async (event: Request) => {
47
47
return body ? JSON . parse ( body ) : undefined
48
48
}
49
49
50
- // @TODO
51
- // @TODO
52
- // @TODO
53
- // THis is in a hacked state. Need to figure out why instanceof isn't working in middleware
54
- export const isFetchApiRequest = ( event : any ) : event is Request => {
55
- if ( event instanceof Request || event instanceof PonyFillRequest ) {
50
+ export const isFetchApiRequest = (
51
+ event : Request | APIGatewayProxyEvent
52
+ ) : event is Request => {
53
+ if (
54
+ event . constructor . name === 'Request' ||
55
+ event . constructor . name === PonyFillRequest . name
56
+ ) {
56
57
return true
57
58
}
58
59
59
- if ( event . httpMethod || event . queryStringParameters ) {
60
- return false
61
- }
62
-
63
- // @TODO I dont know why instance of Request is not working in middleware
64
- return true
60
+ return false
65
61
}
66
62
67
63
function getQueryStringParams ( reqUrl : string ) {
Original file line number Diff line number Diff line change @@ -393,10 +393,6 @@ export class DbAuthHandler<
393
393
this . options = options
394
394
this . event = event
395
395
this . httpMethod = isFetchApiRequest ( event ) ? event . method : event . httpMethod
396
- console . log (
397
- `👉 \n ~ file: DbAuthHandler.ts:396 ~ isFetchApiRequest(event):` ,
398
- isFetchApiRequest ( event )
399
- )
400
396
401
397
this . cookie = extractCookie ( event ) || ''
402
398
You can’t perform that action at this time.
0 commit comments