Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Add ability to not throw exception when http status code > 399

Aperta
#1,215 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
java, spring
Ambito
api, backend

Direzione di ricerca

Inizia tracciando il modo in cui il client OpenFeign gestisce le risposte con codici di stato HTTP superiori a 399. Definisci un comportamento opt-in che consenta ai chiamanti di ricevere l’entità della risposta restituita invece di un’eccezione e verifica che il comportamento di eccezione esistente rimanga invariato quando l’opzione non è abilitata.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

waiting-for-triage

urrently our team convention is to use response status instead of throwing exception. Say our model is like this:

public class BaseResponse {
private String message;
private int httpStatusCode;
private Boolean isFailed;
private int errorCode;
}
So when our API endpoint failed, we return BaseResponse with failed status instead. Now this is not possible to be read by the client using openfeign since feign will throw exception directly if >399 response status retrieved, so our returned response is useless. We can make our api to return 200 status code instead, but that would violate RESTFUL.

Understand that openfeign is designed to be strictly RESTFUL, but I don't think forcing your user to throw exception is the right thing, because different teams have different convention used on how they handle the failure, and in our case we use our response entity that would describe the failure status.

I appreciate if this feature can be considered, and I will be happy to contribute if needed. Thank you.

Lingua principale
Java
Stelle
1.3k
Fork
835
Merge medio
14h 2m
PR unite (30g)
22

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di spring-cloud/spring-cloud-openfeign

Tutte le issue di spring-cloud/spring-cloud-openfeign

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.