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

Only prefix a slash on the api_gateway_base_path if needed #138

Merged
merged 2 commits into from
Sep 28, 2020

Conversation

dspatoulas
Copy link
Contributor

Only appends a prefix to the api_gw_base_path if it's not there already to avoid duplicate prefix slashes.

Issue: #137

Intended Design Change

api_gw_base_path = "prod"
api_gw_base_path = "/prod"

def lambda_handler(event, context):  # pragma: no cover
    handler = mangum.Mangum(api, api_gateway_base_path=settings.api_gw_base_path.lstrip("/"))  #137 Avoids the need for all consumers to call .lstrip("/") on their base path str
    response = handler(event, context)
    return response

@jordaneremieff
Copy link
Collaborator

@dspatoulas Looks like a good improvement, thanks!

Could you code format the adapter file with black and push again? Looks like the line-length of the change is just sightly too long, so this will cause the build to fail. Once this is resolved I'll merge it in.

@jordaneremieff jordaneremieff merged commit dc16f7f into Kludex:main Sep 28, 2020
@dspatoulas dspatoulas deleted the api_gw_base_path_enhancement branch September 28, 2020 13:43
four43 pushed a commit to four43/mangum that referenced this pull request Mar 27, 2021
* Only prefix a slash on the api_gateway_base_path if needed

* Improve readability and compatibility with black python linter

Co-authored-by: DJ Spatoulas <djs@knowbe4.com>
four43 pushed a commit to four43/mangum that referenced this pull request Aug 20, 2021
* Only prefix a slash on the api_gateway_base_path if needed

* Improve readability and compatibility with black python linter

Co-authored-by: DJ Spatoulas <djs@knowbe4.com>
khamaileon pushed a commit to khamaileon/mangum that referenced this pull request Jan 13, 2024
* Only prefix a slash on the api_gateway_base_path if needed

* Improve readability and compatibility with black python linter

Co-authored-by: DJ Spatoulas <djs@knowbe4.com>
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