-
Notifications
You must be signed in to change notification settings - Fork 166
feat(event-handler): add resolution logic to base router #4349
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
headers, | ||
multiValueHeaders, | ||
body: await response.text(), | ||
isBase64Encoded: false, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've hardcodedisBase64Encoded
for now but we will need to figure out how to deal with this
@@ -133,11 +139,49 @@ abstract class BaseRouter { | |||
}; | |||
} | |||
|
|||
public abstract resolve( | |||
public async resolve( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that this function has an implementation, there are no abstract methos remaining. Should BaseRouter
still be an abstract class?
|
||
try { | ||
const request = proxyEventToWebRequest(event); | ||
const path = new URL(request.url).pathname as Path; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, I dislike casting, should these two assignments use type guards?
f5d5280
to
14a6f53
Compare
|
Summary
This PR implements the final resolution logic for the
BaseRouter
class. Theresolve
method is no longer abstract and has a concrete implementation where it looks up the route registry using the path and tries to retirve a resolver for the route. If not route is found, we throw aNotFoundErroe
. If any exceptions are thrown from the handler, these are caught and handled by the already existinghandleError
method.Changes
BaseRouter
to have. oncrete implementation ofresolve
methodAPIGatewayProxyResult
type that lambda expectsresolve
function is implemented in the base classthis
context is preserved when using decorators.Issue number: closes #4142
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.
Disclaimer: We value your time and bandwidth. As such, any pull requests created on non-triaged issues might not be successful.