### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

Currently the VTL template for `request_templates` is not processed properly:

```
#set( $body = $input.json("$") )

#macro( loop $map )
{
    #foreach($key in $map.keySet())
        #set( $k = $util.escapeJavaScript($key) )
        #set( $v = $util.escapeJavaScript($map.get($key)).replaceAll("\\'", "'") )
        "$k": "$v"
        #if( $foreach.hasNext ) , #end
    #end
}
#end

{
    "enhancedAuthContext": #loop($context.authorizer),

    "headers": #loop($input.params().header),

    "query": #loop($input.params().querystring),

    "path": #loop($input.params().path),

    "identity": #loop($context.identity),

    "stageVariables": #loop($stageVariables),
}
EOF
}
```

results in,

```
'

{
    "enhancedAuthContext": {
    }
,

    "headers": {
    }
,

    "query": {
    }
,

    "path": {
    }
,

    "identity": {
    }
,

    "stageVariables": {
    }
,
}
'
```

### Expected Behavior

The template should be rendered and have the JSON properties.

### How are you starting LocalStack?

Custom (please describe below)

### Steps To Reproduce

#### How are you starting localstack (e.g., `bin/localstack` command, arguments, or `docker-compose.yml`)

    docker run localstack/localstack

#### Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)

    awslocal s3 mb s3://mybucket


### Environment

```markdown
- OS: MacOS
- LocalStack: 0.14
```


### Anything else?

This example can be used to validate.
https://github.com/localstack/localstack-terraform-samples/tree/master/apigateway-lambda-velocity
relative_path_w_query_params = "/%s" % path.lstrip("/").partition("/")[2]
    elif test_invoke_match:
        
        stage = None
        region_name = invocation_context.region_name
        api_id = test_invoke_match.group(1)
        resource_id = test_invoke_match.group(2)
        query_string = test_invoke_match.group(4) or ""
        apigateway = aws_stack.connect_to_service(
            service_name="apigateway", region_name=region_name
        )
        resource = apigateway.get_resource(restApiId=api_id, resourceId=resource_id)
        resource_path = resource.get("path")
        relative_path_w_query_params = f"{resource_path}{query_string}"
    else:
        raise Exception(
            f"Unable to extract API Gateway details from request: {path} {dict(headers)}"
        )
    if api_id:
        
        if getattr(THREAD_LOCAL, "request_context", None) is not None:
            THREAD_LOCAL.request_context.headers[MARKER_APIGW_REQUEST_REGION] = API_REGIONS.get(
                api_id, ""
            )
    
    invocation_context.api_id = api_id
    invocation_context.stage = stage
    invocation_context.path_with_query_string = relative_path_w_query_params
    return invocation_context
def extract_api_id_from_hostname_in_url(hostname: str) -> str: