我正在尝试从这个简单的 Lambda 中访问键值package mainimport ( "github.com/aws/aws-lambda-go/events" "github.com/aws/aws-lambda-go/lambda" "net/http")func Draw(request events.APIGatewayProxyRequest) (events.APIGatewayProxyResponse, error) { return events.APIGatewayProxyResponse{ StatusCode: http.StatusOK, Body: "Draw API " + request.Body, }, nil}func main() { // https://www.alexedwards.net/blog/serverless-api-with-go-and-aws-lambda lambda.Start(Draw)}并带有简单的卷曲curl -d "timestamp=11223344" https://xxxxxxx.execute-api.us-east-1.amazonaws.com/dev/api/draw我得到Draw API timestamp=11223344我如何获得键/值字符串或带有参数名称和值的映射?不幸的是我不能使用 json 作为输入谢谢!
1 回答
千巷猫影
TA贡献1829条经验 获得超7个赞
你可能会使用net/url.ParseQuery
import "net/url" ... kv, err := url.ParseQuery("foo=bar")
- 1 回答
- 0 关注
- 85 浏览
添加回答
举报
0/150
提交
取消