@FormParam of jaxrs cannot pass arguments

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

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

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

評価

難易度
4/5
見積もり時間
3〜5日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
停滞
技術スタック
java
領域
api, backend

調査の方向性

Issue に示されている JAXRSContract と Feign.builder の設定から始め、@FormParam が feign.jackson.JacksonEncoder に到達するまでを追跡します。意図した application/x-www-form-urlencoded リクエストと encoder の出力を比較します。username 引数が JSON ではなくフォームデータとして送信され、再現可能なテストまたは文書化された設定があれば完了です。

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

説明

feedback provided question

jaxrs version: 3.0.7.Final
feign version: 11.10

I want to use @FormParam to pass arguments, and this is my code :

server:

    @POST
    @Path("/system/authentication/findGroupByUserName")
    List<Group> findGroupByUserName(@FormParam("username") String string);

client, service:

    @POST
    @Path("/system/authentication/findGroupByUserName")
    @Headers(value = {" content-type : application/x-www-form-urlencoded "})
    List<Group> findGroupByUserName(@FormParam("username") String string);

client feign builder:

  Feign.builder()
            // required values 
            .logger(new Slf4jLogger(type))
            .client(new ApacheHttpClient(HttpClientUtils.getHttpClient()))
            .contract(new JAXRSContract())
            .encoder(new JacksonEncoder())
            .decoder(new JacksonDecoder())
            .options(options);

My JAXRSContract class is copy from feign-jaxrs peoject and I wrote some code so that it can parse the @Headers annotation.
Now my issue is that the argument usename is encode to json instead of form.
I have traced the code and found the code below : feign.jackson.JacksonEncoder#encode
image

The data format of the form is: username = '123456', but the data format of the json is {"username":"123456"}. So how can i config the feign builder to make it work , or is there some other solutions.

Thanks !

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

環境構築

はじめの一歩

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

OpenFeign/feign のほかの issue

OpenFeign/feign の issue をすべて見る

似ている issue

Java の issue をもっと見る

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

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