0
나는 그것을 기대하는 방법을 작동 다음 템플릿을 구문 분석 :속도 템플릿이 잘못 JSON 유효한 JSON
#set($allParams = $input.params())
{
"body" : $input.json('$'),
"params" : {
#foreach($type in $allParams.keySet())
#set($params = $allParams.get($type))
"$type" : {
#foreach($paramName in $params.keySet())
"$paramName" : "$util.escapeJavaScript($params.get($paramName))"#if($foreach.hasNext),#end
#end
}#if($foreach.hasNext),#end
#end
}
}
무엇을 나에게 귀찮은 것은이 템플릿은 여전히 유효 JSON을 구문 분석하는 것입니다.
{
"body" : {
"asdasd": "[email protected]#$%^&*()"
},
...
}
내 질문은 왜 :
{
"example": [email protected]#$%^&*()_+
}
로 변환됩니다 위의 템플릿을 사용하여 : 변환하기 전에 다음 무효 JSON 주어진 예를 들어
? $input.json('$')
은 잘못된 JSON 문자열을 구문 분석하지 않아야합니까?
편집 됨 로그 아래 :
Execution log for request test-request
Fri Oct 06 21:27:13 UTC 2017 : Starting execution for request: test-invoke-request
Fri Oct 06 21:27:13 UTC 2017 : HTTP Method: POST, Resource Path: /equipment
Fri Oct 06 21:27:13 UTC 2017 : Method request path: {}
Fri Oct 06 21:27:13 UTC 2017 : Method request query string: {}
Fri Oct 06 21:27:13 UTC 2017 : Method request headers: {}
Fri Oct 06 21:27:13 UTC 2017 : Method request body before transformations: {
"asdasd": 123123$%^&*()
}
Fri Oct 06 21:27:13 UTC 2017 : Endpoint request body after transformations: {
"body" : {"asdasd":"123123$%^&*()"},
"params" : {
....
입력 개체 란 무엇입니까? – user7294900
http://adocs.aws.amazon.com/apigateway/latest/developerguide/api-gateway-mapping-template-reference.html#input-variable-reference –
그런 다음 문제는 Amazon API에서 발생하지만 Velocity에서는 발생하지 않습니다. 거기에 버그 보고서를 제출해야합니다. –