Skip to content

Document that Logger reflects Feign's Request, not the wire request - #3544

Open
ChrisJr404 wants to merge 1 commit into
OpenFeign:masterfrom
ChrisJr404:logger-wire-request-doc
Open

Document that Logger reflects Feign's Request, not the wire request#3544
ChrisJr404 wants to merge 1 commit into
OpenFeign:masterfrom
ChrisJr404:logger-wire-request-doc

Conversation

@ChrisJr404

Copy link
Copy Markdown

Adds a note to the Logger class javadoc explaining that request logging reflects the Request that Feign builds, which can differ from what the underlying Client actually sends. The default HttpURLConnection based Client drops headers the JDK treats as restricted, so a header can show up in the log without being on the wire. Closes #2682.

@velo velo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for adding this — the clarification about Logger reflecting Feign's Request rather than the wire request is a genuinely useful thing to document, and I confirmed the core claim is accurate (Logger.logRequest is called in SynchronousMethodHandler before client.execute, so the request logged really can differ from what goes over the wire).

Two things before merging:

  1. The doc points at {@link Client.Default}, but that class is @Deprecated (see its javadoc: "use DefaultClient instead"). Feign.Builder actually defaults to new DefaultClient(...), and the restricted-header-dropping behavior you're describing lives in DefaultClient (e.g. the Content-Length: 0 handling around line 228), not in the deprecated wrapper. Please repoint the {@link} to DefaultClient.

  2. Consider moving the detailed JDK-specific rationale (the HttpURLConnection restricted-headers behavior, sun.net.http.allowRestrictedHeaders, specific header names) onto DefaultClient's own class javadoc, with a short pointer from Logger's doc ("see {@link DefaultClient} for a concrete example"). That keeps the detail next to the code that actually causes it, where someone touching DefaultClient's header handling would be looking.

Happy to merge once the class reference is fixed.

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.

Logger logs unsent request headers even though Default in Client has restricted headers

2 participants