Skip to content

[server] Allow multiple filters per URL pattern #72

@fpoehler

Description

@fpoehler

Currently only one filter per URL pattern can be applied:

class Router {
  ...
  void filter(Pattern url, Filter filter) {
    _filters[url] = filter;
  }
}

Each filter added for an already existing URL pattern causes the filter applied formerly to be overwritten.

Sometimes it would be very convenient to be able to apply multiple filters for the same URL pattern, e.g. first an authentication and afterwards an authorization filter.

Then the router should apply both filters in the order they were added, i.e. _filters[url] should be a List or a Queue and filter should perform something like

  _filters[url].add(filter);

(The workarounds – either to combine all the applicable filters in a separate function or to create multiple URL patterns which all resolve to the very same route – are both quite ugly and inconvenient.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions