mirror of
https://github.com/floci-io/floci.git
synced 2026-11-23 22:11:36 -05:00
test(apigatewayv2): execute-api dispatch compat suite (#372)
* fix(apigatewayv2): fix route matching for path-parameter routes
routeKeyMatchesPath() used String.replace() on Pattern.quote() output,
which performs literal string matching. Path-parameter placeholders like
{id} and {proxy+} were wrapped in \Q...\E by Pattern.quote(), making
them invisible to the replace() calls. All parameterized routes silently
failed to match.
Rewritten to iterate over placeholders with a regex Matcher, quoting
only the literal segments between them. {param} maps to [^/]+ and
{proxy+} maps to .+ as before.
* test(apigatewayv2): add execute-api dispatch compat suite
New ApiGatewayV2ExecuteTest exercises the v2 execute-api dispatch
path end-to-end: create HTTP API, deploy a Lambda backend via
LambdaClient, wire integration/route/stage/deployment, then invoke
through the execute-api URL and assert the Lambda response flows
back through the gateway.
Scope (per PLAN_FLOCI_2 Phase 7 prerequisite decisions):
- pins current dispatch behavior where stage existence and deployment
status are NOT checked before dispatch (see
ApiGatewayExecuteController.java:842-847)
- JWT/token authorizer dispatch path only (REQUEST authorizer has no
dispatch path today - out of scope)
- no mapping templates / request transforms (no layer exists in
apigatewayv2/model/Integration.java)
Cross-service blame attribution: if this suite fails while the
existing LambdaTest compat suite passes in the same run, the failure
is on the gateway side.
Gated on Docker for the Lambda backend.
* fix(apigatewayv2): support ANY method and empty proxy in route matching
routeKeyMatchesPath now treats ANY as a wildcard that matches all HTTP
methods, matching AWS API Gateway v2 behavior. Also relaxed {proxy+}
regex from .+ to .* so /echo/{proxy+} matches /echo/ with an empty
proxy value.
* fix(test): skip Lambda-dependent execute tests when dispatch unavailable
CI may not support Docker-in-Docker for Lambda containers. Gate
dispatch and JWT+dispatch tests on the first dispatch response so
they skip instead of fail.
---------
Signed-off-by: Hector Ventura <hectorvent@gmail.com>
Co-authored-by: Hector Ventura <hectorvent@gmail.com>
This commit is contained in:
1 parent
44307bc70f
commit
e2680cf5f5
2 files changed
+300
-1
No files matched your search
+1
-1
@@ -192,7 +192,7 @@ public class ApiGatewayV2Service {
|
||||
int last = 0;
|
||||
while (m.find()) {
|
||||
regex.append(Pattern.quote(pattern.substring(last, m.start())));
|
||||
regex.append(m.group(1).endsWith("+") ? ".+" : "[^/]+");
|
||||
regex.append(m.group(1).endsWith("+") ? ".*" : "[^/]+");
|
||||
last = m.end();
|
||||
}
|
||||
regex.append(Pattern.quote(pattern.substring(last)));
|
||||
|
||||
Reference in new issue
Block a user