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

オープン
#2,944 コメント 3 件 リアクション 2 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
35/100
issue の種類
機能追加
明瞭さ
説明が足りない
活発さ
静か
技術スタック
java
領域
api

調査の方向性

まず、OpenFeign が HTTP ステータスコード 399 超のレスポンスをどのように処理し、例外がどこで生成されるかを追跡します。呼び出し側が返されたレスポンスを読み続けながら、その動作を無効にする方法を特定します。399 超のステータスコードへの対応を含め、レスポンスエンティティを通じて失敗を処理するクライアント向けに、文書化された利用可能なオプションが存在すれば完了です。

索引モデルが issue の本文から書いたものです。

説明

enhancement proposal

Currently 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.

主要言語
Java
スター
9.8k
フォーク
2k
平均マージ
1時間 23分
マージ済み PR(30日)
31

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

OpenFeign/feign のほかの issue

OpenFeign/feign の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。