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.

@POST with @Body doesn't work using @RetrofitClient with WebClient

See original GitHub issue

Describe the bug Please provide details of the problem, including the version of Spring Cloud that you are using.

Hi guys, @OlgaMaciaszek I am trying to use @RetrofitClient with WebClient using the @Body annotation for the body, but it is not working.

I am trying with the following Retrofit Client:

@RetrofitClient(name = "HelloServer", url = "http://localhost:7111", configuration = HelloClientConfiguration.class)
public interface HelloClient {

    @GET("/")
    Mono<String> hello();

    @Headers({"Content-Type: application/json"})
    @POST("/card")
    Mono<Card> create(@Body Card card);
}

I have the following questions:

I would like to know if you have implemented the CallAdapterFactory or ConverterFactory so that the @Body works serializing the object to be set as the request body? We are using the version 0.4.0-M1 of spring-cloud-square-retrofit and the serializing of the Body is not working.

We would like to know if you know about this and how We can do to solve this problem: maybe adding a specific configuration or waiting for the next version of spring-cloud-square?

I am looking forward to hearing from you! Important: If you need help regarding to this issue, please let me know how I can help you.

Best Regards!

Sample If possible, please provide a test case or sample application that reproduces the problem. This makes it much easier for us to diagnose the problem and to verify that we have fixed it.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

2reactions
OlgaMaciaszekcommented, Sep 15, 2021

The bug is there. Will fix it.

0reactions
OlgaMaciaszekcommented, Sep 15, 2021

Thanks, will take a look at this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Retrofit2 doesn't send POST data - Stack Overflow
I use index.php, so when I send POST to my url address I should end it ... @POST("test_json_with_post") Call<DataResponse> createData(@Body ...
Read more >
Method writeAndFlushWith(body) is not invoked in ... - GitHub
I am trying to implement a decorator to ClientHttpRequestDecorator to print some logs using @RetrofitClient @Body with Flux for the request body using...
Read more >
Sending HTTP requests with Spring WebClient - Reflectoring
How to get started using Spring WebClient to talk to REST APIs. ... "another-value"); String response = client.post() .uri(new ...
Read more >
[Tuto] Building a Reactive RESTful API with Spring WebFlux ...
This is exactly why the goal of this post is to guide you through building your first (maybe not) reactive RESTful API with...
Read more >
Learn to Develop a REST API Client with Retrofit and Spring ...
TL;DR: In this article, you will learn how to use Retrofit, an HTTP client library, and Spring Boot to create a client for...
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