github.com/mweagle/Sparta@v1.15.0/docs/source/resources/provision/apigateway/outputmapping_json.vtl (about)

     1  $input.json('$.body')
     2  ## Ok, parse the incoming map of headers
     3  ## and for each one, set the override header in the context.
     4  ## Ref: https://docs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#context-variable-reference
     5  ## Ref: https://docs.aws.amazon.com/apigateway/latest/developerguide/apigateway-override-request-response-parameters.html
     6  #set($headers = $input.path("$.headers"))##
     7  #foreach($key in $headers.keySet())##
     8  #set($context.responseOverride.header[$key] = $headers[$key])##
     9  #end##
    10  ## And use the code rather than integration templates so that
    11  ## the creation time is reduced
    12  #if($input.path("$.code") != "")##
    13  #set($context.responseOverride.status = $input.path("$.code"))##
    14  #end##