OpenFeign / OpenFeign/feign

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

Open
#2,682 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

documentation enhancement
Dominant language
Java
Stars
9.8k
Forks
1.9k
Avg merge
1d 2h
Merged PRs (30d)
41

Description

Since the default class Default in Client uses sun.net.www.protocol.http.HttpURLConnection, which has the set of restricted headers, even if I add a header using RequestTemplate#header(String, String), the actual HTTP request does not contain the header.

However feign.Logger logs not the actual request but the Request made by SynchronousMethodHandler#executeAndDecode(), which contains the restricted header I have added.

This inconsistency made me hard to discover the problem because there's no such documentation tells the logged request may not be the same as the actual HTTP request.

I hope to add some documentation that tells RequestTemplate you applied may not be the actual request or, if possible, make Logger logs the actual HTTP request.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with Default in Client and SynchronousMethodHandler#executeAndDecode(), then trace how RequestTemplate#header(String, String) reaches feign.Logger and the sun.net.www.protocol.http.HttpURLConnection client. Compare the logged Request with the headers sent by the actual HTTP request; done means either documenting this discrepancy clearly or making the logger reflect the sent request.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Needs clarification
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.