-
Notifications
You must be signed in to change notification settings - Fork 176
fix(event-handler): allow event handler response to return array #4725
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?
fix(event-handler): allow event handler response to return array #4725
Conversation
…tryAddErrorCodeToBody methods
…th object and array formats
…cleaner test setup
|
| * @param body - The response body returned by the error handler, of type JSONValue | ||
| * @param error - The Error object associated with the response | ||
| */ | ||
| #errorBodyToResponse(body: JSONValue, error: Error): Response { |
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.
Let's call this errorBodyToWebResponse.
| (event: unknown, _context: Context, responseStream: MockResponseStream) => | ||
| app.resolveStream(event, _context, { scope, responseStream }); | ||
|
|
||
| const createTestLambdaClass = (app: Router, expectedResponse: unknown) => { |
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.
Let's move this function to the event-handler/tests/unit/rest/helpers.ts file.
|
Two very minor comments but other than that, this is pretty much good to go. |



Summary
Previously, we couldn't return an array as an event handler response. This PR fixes that.
Changes
HandlerResponsetype, replaceJSONObjectwithJSONValueExample:
Issue number: closes #4593
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.