hummingbird-project / hummingbird-lambda

Hummingbird running inside an AWS Lambda
Apache License 2.0
24 stars 3 forks source link

Update APIGatewayV2Lambda path getter #6

Closed nicktrienensfuzz closed 1 year ago

nicktrienensfuzz commented 1 year ago

Use the context.http.path value, which is set when using catchall routes in the serverless file.

catchall routes in the serverless file

functions:
  http:
    handler: handle
    memorySize: 1024
    timeout: 30
    events:
        - httpApi: '*'

From testing it seems like the routeKey is only fully set if the path is defined in the serverless file, since the code isn't using the stage portion of the routeKey anyway I'd suggest using the more standard path. Worth noting that APIGatewayRequest is already using the path property.

In the case of catchall paths you can see the incoming request as logged to cloudwatch here

Screenshot 2023-06-30 at 11 37 22 PM
codecov[bot] commented 1 year ago

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.08 :warning:

Comparison is base (536cf5d) 85.49% compared to head (cf1f985) 85.41%.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #6 +/- ## ========================================== - Coverage 85.49% 85.41% -0.08% ========================================== Files 7 7 Lines 193 192 -1 ========================================== - Hits 165 164 -1 Misses 28 28 ``` | [Impacted Files](https://app.codecov.io/gh/hummingbird-project/hummingbird-lambda/pull/6?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hummingbird-project) | Coverage Δ | | |---|---|---| | [Sources/HummingbirdLambda/APIGatewayV2Lambda.swift](https://app.codecov.io/gh/hummingbird-project/hummingbird-lambda/pull/6?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=hummingbird-project#diff-U291cmNlcy9IdW1taW5nYmlyZExhbWJkYS9BUElHYXRld2F5VjJMYW1iZGEuc3dpZnQ=) | `86.36% <100.00%> (-0.60%)` | :arrow_down: |

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.