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

Return original attributes from webflux ClientRequest #1805

Merged
merged 4 commits into from
Apr 24, 2024

Conversation

Dyuvarov
Copy link
Contributor

@Dyuvarov Dyuvarov commented Apr 13, 2024

Description

Spring request has attributes. The current implementation of ClientRequest from org.zalando.logbook.spring.webflux returns an empty attribute map whether there are attributes or not.
This improvement gives access to the spring request attributes from ClientRequest.getAttributes(). Also added AllAttributesExtractor class to extract all attributes from original request.

Motivation and Context

In a project my team is working on, we pass some data for spring WebClient request and response audit log messages via attributes. Now we have to use reflection to access them in the AttributeExtractor implementation because ClientRequest.getAttributes() returns HttpAttributes.EMPTY by default

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@Dyuvarov
Copy link
Contributor Author

@whiskeysierra @lukasniemeier-zalando @kasmarian @msdousti
Hello, guys. This is just a friendly reminder to review this pull request. Thanks!

Copy link
Collaborator

@msdousti msdousti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR. I like the idea of ClientRequest returning the request.attributes as provided by the Spring Framework.

Please take a look at my comments on AllAttributesExtractor.

@Dyuvarov Dyuvarov requested a review from msdousti April 24, 2024 11:20
@msdousti
Copy link
Collaborator

@Dyuvarov Thanks a lot for your contribution!

@kasmarian The PR is OK from my side :)

@kasmarian
Copy link
Member

👍

@kasmarian kasmarian merged commit f29dad2 into zalando:main Apr 24, 2024
2 checks passed
@kasmarian
Copy link
Member

Thank you for the PR and for the review 👏

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

Successfully merging this pull request may close these issues.

3 participants