我正在为 API 使用 Netlify 函数,除了我需要访问 URL 参数时,其中大部分都可以正常工作
这是我必须获取参数的片段:
func Handler(ctx context.Context, request events.APIGatewayProxyRequest) (Response, error) {
id := request.PathParameters["id"]
...
}
func main() {
lambda.Start(Handler)
}
我有其他功能正常工作,不需要 URL 参数,但无法弄清楚如何让这些功能正常工作,我尝试了多种不同的选择:
https://example.com/endpoint/1
https://example.com/endpoint/id=1
https://example.com/endpoint?id=1
以上均未在命中端点时返回 id 路径参数