question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Filters in the route Spec are easy to confuse

See original GitHub issue

Is your feature request related to a problem? Please describe. As a beginner user, I confused pre- and post- filters. The Spec builder API feels like it is a builder, but, in fact, it depends on the order.

From looking at the following, it is hard to answer “does it work the same?”:

r
        .method(HttpMethod.PUT)
        .filters(f -> f.filter(myFilter))
        .uri("http://mytarget/");

vs:

r
        .method(HttpMethod.PUT)
        .uri("http://mytarget/")
        .filter(myFilter);

Describe the solution you’d like I suggest renaming the methods, so that it becomes:

r
        .method(HttpMethod.PUT)
        .preFilters(f -> f.filter(requireAccessTokenFilter))
        .uri("http://mytarget/")
        .postFilter(removeOriginHeadersFiltler);

Describe alternatives you’ve considered None at the moment.

Additional context This is a follow of #1645.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
spencergibbcommented, Apr 1, 2020

I have a fix, but it is a breaking change since the javadsl is leaky and returns a builder from outside the dsl.

0reactions
spencergibbcommented, Apr 1, 2020

never mind, the fact that there is a .filter() method after .uri() is the oddity, it should be a terminal builder method (maybe?). You should use .filters(f -> {}) after the predicate.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Understanding Route Filters for Use in Routing Policy Match ...
A route filter is a collection of match prefixes. When specifying a match prefix, you can specify an exact match with a particular...
Read more >
svenfuchs/routing-filter - GitHub
Routing filters wrap around the complex beast that the Rails routing system is to allow for unseen flexibility and power in Rails URL...
Read more >
Filtering BGP advertisements, routes, etc. - Cisco Community
Solved: What would be the best way to filter route advertisements from and to a BGP ... It is easy to add a...
Read more >
9. Routing Policy and Firewall Filters - JUNOS Cookbook [Book]
However, because they are so similar, it's sometimes easy to confuse the two. The most important point to remember is that routing policy...
Read more >
Routing & Input - R Plumber
Plumber has two distinct families of functions that it handles: endpoints and filters. Typically, when a request arrives to a Plumber router, Plumber...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found