Uh oh!
There was an error while loading. Please reload this page.
feat: add support for APIGWv2 protocol (#64) - #88
Conversation
| // TODO - is option 1 safe? If so, then it is the simpler approach | ||
| // Option 1. join evt.cookies with semicolons | ||
| // Option 2. reduce the list, parseing and merging into cookies |
| export function isALBResult(evt: ResponseResult, test: boolean): evt is ALBResult { | ||
| // TODO - this type gaurd doesn't do any useful checking | ||
| return test && 'statusCode' in evt; | ||
| } |
There was a problem hiding this comment.
Flagging this TODO for feedback on this approach to using a type guard. Doesn't seem to be any attributes that can consistently be used to differentiate between the types. So seems like we can either:
A. Use a type guard like this.
B. Extend ALBResult to have an attribute we set to indicate if it is ALB, and then base the type guard on that attribute.
| // make sure that undefined values don't break it: | ||
| let evt2: RequestEvent = albRequest(); | ||
| // TODO - this doesn't seem possible without encountering: error TS2790: The operand of a 'delete' operator must be optional. | ||
| // // make sure that undefined values don't break it: | ||
| // let evt2: RequestEvent = albRequest(); | ||
| delete evt2.httpMethod; | ||
| expect(evt2.httpMethod).to.strictlyEqual(undefined); | ||
| expect(new Request(app, evt2, handlerContext()).method).to.strictlyEqual(''); | ||
| // delete evt2.httpMethod; | ||
| // expect(evt2.httpMethod).to.strictlyEqual(undefined); | ||
| // expect(new Request(app, evt2, handlerContext()).method).to.strictlyEqual(''); |
There was a problem hiding this comment.
Flagging this TODO for feedback. I think that this no longer works with the updated type definitions and needs to be removed.
Photon0gen
commented
Jun 10, 2024
I will split the package upgrades and related changes into a separate pull request, but figured it would be simpler to get initial feedback with all the changes together. |
No description provided.