Azure/azure-webjobs-sdk

Bind multiple query values with the same name.

Opened this issue · 1 comments

From @peterbomers on June 14, 2018 14:42

Hi!

In the previous version of the library (azure-functions-java-core) bound query values with the same name resulted in a comma separated string. In the new version I only get the last found.

Example request: https://test.azurewebsites.net/api/test?scopes=1&scopes=2

public static HttpResponseMessage function( final HttpRequestMessage request,  @BindingName( "scopes" ) final String scopes,  final ExecutionContext context ) {

            context.getLogger().info(scopes);
            return request.createResponse( 200, "OK" );

    }

Output:
previous version: "1,2"
new version: "2"

Is there a new syntax to bind multiple query values with the same name?

Copied from original issue: Azure/azure-functions-java-library#15

Query string parameters are NameValueCollection and ASP.Net allows specifying mutiple query string parameters with the same name. In the example above, accessing query string parameters off of HttpRequest, appends values scopes=1,2

but binding data provided by Binder here only gives the last match

Binder.BindingData is used to provide TriggerMetadata for out-of-proc languages see here