Search code examples
aqueduct

Optional query params aqueduct


Went through the documentation, couldn't find any.

How does one make an optional query param in aqueduct?


Solution

  • By wrapping an argument in curly brackets:

    @Operation.get()
    Future<Response> getAllCities({@Bind.header('x-api-key') String apiKey}) async 
    {}
    

    This is documented here: http://aqueduct.io/docs/http/resource_controller/#optional-bindings