question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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();

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:4
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
karellen-kimcommented, Jul 20, 2021

I’m interested in this!

2reactions
ghkim3221commented, Jul 19, 2021

Additionally, how do you think similar feature, HttpRequest.ofJson? Additionally, how about adding HttpRequest.ofJson also?

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to send request body in spring-boot web client?
The above answer is correct: Adding application/json in your Content-Type header solves the ...
Read more >
Get List of JSON Objects with WebClient - Baeldung
In this article, we'll find out how to convert a JSON Array into a Java Array of Object, Array of POJO, and a...
Read more >
How to Read JSON Data with Spring WebClient - amitph
In this tutorial, first, we will use WebClient to read a single JSON object and parse it into a POJO. Later, we will...
Read more >
Sending HTTP requests with Spring WebClient - Reflectoring
How to Make a GET Request with WebClient · We create a WebClient instance · We define a request using the WebClient instance,...
Read more >
Spring Boot - How to use WebClient - Home - Gustavo Peiretti
ClientResponse response = webClient.post() .uri("/accounts") .body ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found