line/armeria

Provide a way to send a JSON object with `WebClient`

オープン

#3,707 opened on 2021/07/19

 (10 件のコメント) (4 件のリアクション) (1 人の担当者)Java (863 件のフォーク)batch import
good first issuenew feature

Repository metrics

Stars
 (4,552 個のスター)
PR merge metrics
 (平均マージ 5d 12h) (30d で 42 merged PRs)

説明

JSON is the dominant exchange format for REST API. However, Armeria's WebClient does not provide any JSON-specific APIs. I believe it should be useful additions if we provide:

WebClient client = WebClient.of();
// Send a serialized JSON object with "applicaiton/json"
HttpResponse response = client.postJson("/items", new MyItem()); 
HttpResponse response = client.putJson("/items", new MyItem());
HttpResponse response = client.patchJson("/items", new MyItem());

HttpResponse response = client.prepare()
                              .post("/items")
                              .contentJson(new MyItem())
                              .execute();

コントリビューターガイド