Skip to content
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

Allow using multiple strategies for multiple set of paths #1875

Open
Marchosiax opened this issue Jul 29, 2024 · 3 comments
Open

Allow using multiple strategies for multiple set of paths #1875

Marchosiax opened this issue Jul 29, 2024 · 3 comments
Labels

Comments

@Marchosiax
Copy link

Marchosiax commented Jul 29, 2024

Detailed Description

Allowing multiple strategies to work alongside each other for different situations. For example one strategy to work for a set of paths, conditions and/or filters, while having another strategy for different paths and conditions.

Context

We have a requirement to log request and response for certain paths regardless of the status of the response. So I use include to log these paths by using the default strategy. However, there are some paths which doesn't need to be logged unless an error happens. In which case we need to see what was the request body or param that lead to this error.

I know status-at-least or body-only-if-status-at-least exist but there's no way to have both the default and one of the two mentioned strategies together. I tried to work this out with filters and other configs but had no success.

Your Environment

  • Version used: 3.9.0
  • Using logbook-spring-boot-webflux-autoconfigure with Spring WebFlux
@whiskeysierra
Copy link
Collaborator

whiskeysierra commented Jul 29, 2024 via email

@Marchosiax
Copy link
Author

@whiskeysierra How would I approach your suggestion? Could you give me a rough example?

By the way I guess it doesn't have to be a new strategy. It could be a new kind of Predicate which accepts minimum status as parameter.
Something like this:

  predicate:
    include:
      - path: /test/logged
        methods:
          - POST
        min-status: 400

@whiskeysierra
Copy link
Collaborator

whiskeysierra commented Jul 29, 2024 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants