gpt4 book ai didi

Azure Function 可选查询参数

转载 作者:行者123 更新时间:2023-12-02 06:40:41 25 4
gpt4 key购买 nike

有没有办法在 Azure Functions 中设置可选查询参数?该参数不应设置为路由参数。为了获取查询参数,我使用以下代码片段

IDictionary<string, string> queryParams = req.GetQueryParameterDictionary();

方法签名如下:

public async Task<IActionResult> Function(
[HttpTrigger(AuthorizationLevel.Function, "post", Route = null)] HttpRequest req,
[DurableClient] IDurableOrchestrationClient starter
)

最佳答案

如果你不想将其设置为路由参数,可以使用如下:

string param = req.Query["param"];

if (string.IsNullOrEmpty(param)) {
//do nothing.
} else {
//do something.
}

关于Azure Function 可选查询参数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63390164/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com