mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(apigateway): register native VTL map reflection (#4405)
* fix(apigateway): register native VTL map reflection * fix(apigateway): package VTL reflection metadata for native build * test(apigateway): cover native VTL collection methods * chore(ci): retry flaky test shard * chore(ci): retry timed out test shard --------- Co-authored-by: Vamsi Akavarapu <16164447+vamsiak@users.noreply.github.com>
This commit is contained in:
1 parent
26eafba246
commit
41d07f6e3b
3 files changed
+108
No files matched your search
+13
@@ -64,6 +64,19 @@ class VtlTemplateEngineTest {
|
||||
assertEquals("\"Bob\"", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void parsedMapAndCollectionMethodsInResponseTemplate() {
|
||||
String template = "#set($parsed = $util.parseJson($input.body))"
|
||||
+ "#if($parsed.headers)$parsed.headers.isEmpty()|$parsed.headers.size()|"
|
||||
+ "#foreach($entry in $parsed.headers.entrySet())$entry.getKey()=$entry.getValue()#end|"
|
||||
+ "$parsed.items.isEmpty()|$parsed.items.size()|#foreach($item in $parsed.items)$item#end#end";
|
||||
|
||||
String result = engine.evaluate(template, ctx("{\"headers\":{\"x-test\":\"yes\"},\"items\":[\"a\",\"b\"]}"))
|
||||
.body().trim();
|
||||
|
||||
assertEquals("false|1|x-test=yes|false|2|ab", result);
|
||||
}
|
||||
|
||||
@Test
|
||||
void inputPath() {
|
||||
String result = engine.evaluate("$input.path('$.name')", ctx("{\"name\":\"Carol\"}")).body();
|
||||
|
||||
Reference in new issue
Block a user