Skip to content
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

feat: Add support for http events in invoke local #264

Merged
merged 2 commits into from Jun 14, 2021

Conversation

CorentinDoue
Copy link
Contributor

@CorentinDoue CorentinDoue commented Jun 14, 2021

Description

This pull request follows #258 and adds the implementation of the command invoke local for HTTP events from the google provider.

Implementation

Cloud functions triggered by HTTP use express 4.17.1.

  1. Default req and res are recreated as they are provided by express to the handler in the cloud
  2. The content of req is overridden by the data provided for the local execution
  3. The end method of res is overridden by a custom method to
    1. prevent the default behavior of end (send back the response to the client)
    2. get the body of the response to logging it
    3. end the local invocation

Tests

  • Units
  • e2e with ES5 JS
  • e2e with compiled JS/TS with webpack
  • e2e with compiled JS/TS with esbuild

Next steps

@CorentinDoue
Copy link
Contributor Author

cc @pgrzesik

Copy link
Collaborator

@pgrzesik pgrzesik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot @CorentinDoue - well done, I don't have any comments 🙇 I'll prepare a new release sometime this week

@pgrzesik pgrzesik merged commit 446d161 into serverless:master Jun 14, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants