Azure功能可选查询参数

空手道

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

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

Methode签名如下:

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

如果您不想将其设置为route参数,则可以使用如下所示:

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

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

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章