【发布时间】:2023-01-24 01:54:53
【问题描述】:
我正在尝试使用 public.ecr.aws/lambda/python:3.8 图像测试本地 Lambda 函数。我在使用 task 将 curl POST 正确转义/编码到此 API 端点时遇到问题。
如果 json 负载被编码,API 会抱怨:
[test] {"errorMessage": "Unable to unmarshal input: Expecting property name enclosed in double quotes: line 1 column 2 (char 1)", "errorType": "Runtime.UnmarshalError", "stackTrace": []}
如果不是,task 命令会抱怨:
yaml: line 7: did not find expected key
这是taskfile.yml:
version: "3"
tasks:
default:
desc: Test the API
cmds:
- curl -XPOST http://localhost:9000/2015-03-31/functions/function/invocations -d '{'name': 'Todd'}'
【问题讨论】: