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

allow headers to be set from integration definition for HTTP integrat… #10035

Merged
merged 1 commit into from Jan 10, 2024

Conversation

jimmydurkin
Copy link
Contributor

Motivation

Unlike the lambda integration, which allows headers to be set from the integration definition, the HTTP integration passes the invocation context headers directly to the backend without applying the headers from the integration. This change addresses #10034 and allows additional headers to be sent to the backend which matches our ability to do this in the AWS cloud.

Changes

Headers defined in an integration are now able to be sent along to the backend.

2024-01-09 10:03:04 {
2024-01-09 10:03:04     "type": "HTTP_PROXY",
2024-01-09 10:03:04     "httpMethod": "ANY",
2024-01-09 10:03:04     "uri": "http://api-proxy/{proxy}",
2024-01-09 10:03:04     "connectionType": "INTERNET",
2024-01-09 10:03:04     "requestParameters": {
2024-01-09 10:03:04         "integration.request.header.x-hello": "'hello'",
2024-01-09 10:03:04         "integration.request.path.proxy": "method.request.path.proxy"
2024-01-09 10:03:04     },
2024-01-09 10:03:04     "passthroughBehavior": "WHEN_NO_MATCH",
2024-01-09 10:03:04     "timeoutInMillis": 29000,
2024-01-09 10:03:04     "cacheNamespace": "q3jxp7vw3s",
2024-01-09 10:03:04     "cacheKeyParameters": []
2024-01-09 10:03:04 }
... print(headers)
2024-01-09 10:03:31 x-localstack-tgt-api: apigateway
2024-01-09 10:03:31 X-Forwarded-For: awslocal:4566
2024-01-09 10:03:31 x-localstack-edge: http://awslocal:4566
2024-01-09 10:03:31 x-hello: 'hello'
2024-01-09 10:03:31 

Testing

  • I would love to add testing but am a bit new to python so am not sure where best to add it (e.g. what to mock and all that)

@localstack-bot
Copy link
Collaborator

localstack-bot commented Jan 9, 2024

CLA Assistant Lite bot All contributors have signed the CLA ✍️ ✅

Copy link
Collaborator

@localstack-bot localstack-bot left a comment

Choose a reason for hiding this comment

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

Welcome to LocalStack! Thanks for raising your first Pull Request and landing in your contributions. Our team will reach out with any reviews or feedbacks that we have shortly. We recommend joining our Slack Community and share your PR on the #community channel to share your contributions with us. Please make sure you are following our contributing guidelines and our Code of Conduct.

@jimmydurkin
Copy link
Contributor Author

I have read the CLA Document and I hereby sign the CLA

@bentsku bentsku added aws:apigateway Amazon API Gateway semver: patch Non-breaking changes which can be included in patch releases labels Jan 9, 2024
@calvernaz calvernaz self-assigned this Jan 9, 2024
@calvernaz
Copy link
Contributor

calvernaz commented Jan 9, 2024

Hi @jimmydurkin, thanks for tackling this and providing the instructions to reproduce it. I'll review it and add a tests to it

@calvernaz calvernaz merged commit 73df2b8 into localstack:master Jan 10, 2024
21 of 27 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
aws:apigateway Amazon API Gateway semver: patch Non-breaking changes which can be included in patch releases
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants