Skip to content

Pass Lambda Context to web app in a new header #248

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

Merged
merged 2 commits into from
Jul 3, 2023

Conversation

mbfreder
Copy link
Contributor

@mbfreder mbfreder commented Jul 3, 2023

Issue #, if available: #244

Description of changes:

Made Lambda Context available to web apps in a new header (x-amzn-lambda-context).

Note : The implementation broke some tests because the LambdaRequest object used to send the request to the mock server doesn't have a lambda context, resulting in an error ("Request did not contain a lambda context") when "let lambda_context = &event.lambda_context();" is called. I fixed this by replacing LambdaRequest with Request, which allows adding the lambda context.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@bnusunny
Copy link
Contributor

bnusunny commented Jul 3, 2023

Thanks for the contribution.

Could you add one test to check if the new header is present? You can do it when creating the mock server.

        when.method(GET)
            .path("/")
            .header_exists("x-amzn-lambda-context");

@mbfreder
Copy link
Contributor Author

mbfreder commented Jul 3, 2023

Thanks for the contribution.

Could you add one test to check if the new header is present? You can do it when creating the mock server.

        when.method(GET)
            .path("/")
            .header_exists("x-amzn-lambda-context");

Done, thanks.

@bnusunny bnusunny merged commit 14ce8e1 into awslabs:main Jul 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants