Skip to content

Add extension for QueryCollection #195

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 13, 2021
Merged

Add extension for QueryCollection #195

merged 2 commits into from
Aug 13, 2021

Conversation

justinyoo
Copy link
Contributor

This PR is to add two extension methods to deal with querystring, which is for .NET 5 isolated worker.

NOTE: This feature will be deprecated when the core isolated worker introduces the same capability.

In in-proc worker, we're able to use req.Query to get the IQueryCollection instance. As there's no equivalent in the out-of-proc worker, this extension will do the same, with slightly different naming.

public static async Task<HttpResponseData> Run(
    [HttpTrigger(AuthorizationLevel.Function, "GET")] HttpRequestData req,
    FunctionContext executionContext)
{
    // To get the whole IQueryCollection
    var queries = req.Queries();

    // To get the specific query parameter value.
    var value = (string) req.Query("key");

    ...
}

@justinyoo justinyoo added enhancement New feature or request v0.9.0 labels Aug 13, 2021
@justinyoo justinyoo merged commit e5cfa08 into main Aug 13, 2021
@justinyoo justinyoo deleted the feature/querycollection branch August 18, 2021 04:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant