OpenFeign / OpenFeign/feign

Unsatisfying 302 handling

Open
#728 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Hi.

I'm a long time JAX-RS client proxy user which likes the usage of interface generated clients very much. Now I wanted to give feign a try and see how it performs. Setup is simple and integrates nicely in the Spring ecosystems.

But there are still some things which are quite inconvenient and IMHO better solved in JAX-RS.
E.g. 302 handling of errors. JAX-RS won't throw exceptions if 302 is encountered. I already read https://github.com/OpenFeign/feign/issues/249 about the several "workarounds" that I'm not very keen of.

Why not just providing an option in the builder whether to throw or to ignore 302 and leaving the default as before to keep backwards compatibility?

Even If I would try to live with the exception that is thrown, how do I get access to the Response? Since in our case when 302 is returned, the payload contains information we need. FeignException sadly doesn't expose the Response. Also JAX-RS does a better job here where I have access to the response and so the payload. It even provides concrete exception types for well known statuses which make it easy to handle specific error cases.

I would love at least to see that exposing of the response in FeignException to gain more control. Now I have to write my own decoder/error handler and throw my own RedirectException and putting the response to it, being able to process it in the code.

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 Feign's builder configuration and FeignException, then review the decoder and error-handler behavior described in this issue. Determine how 302 responses should be handled and how callers could access the response payload; done means the requested behavior is defined and covered by the relevant tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, backend
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.