Request for Webflux WebClient not captured
See original GitHub issueDescription of the bug
I have a Spring application build with Webflux
.
I have an endpoint called getInfos
and in this endpoint, I have to call GoogleAPI
using a WebClient
In my feature tests, I want to capture the result from Google. This is the pseudo code:
private void getGooglePlaceFromAddress(String address) {
try (HoverflyHelper ignored = HoverflyHelper.simulateOrCapture()) {
response = client.getPlace(address).execute();
} catch (IOException e) {
log.info("Something is wrong");
}
}
The client
is a OkHttpClient
embedded in Retrofit
. We are using openapi
to generate it.
The HoverflyHelper.simulateOrCapture())
only simulate or capture using this line:
HoverflyMode mode = HoverflyMode.CAPTURE;
if (Files.isReadable(myStubPath)) {
mode = HoverflyMode.SIMULATE;
}
hoverfly.setMode(mode);
if (mode == HoverflyMode.SIMULATE) {
hoverfly.simulate(SimulationSource.file(simulationPath));
}
Observed result
I don’t see any error in Hoverfly and no data ae
Additional relevant information
I’ve seen similar issues but none of them fix my case 😕
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Spring Webflux : Webclient : Get body on error - Stack Overflow
I am looking to do the flatMap whatever happen and test myself the status code to deserialize or not the body. java ·...
Read more >Sending HTTP requests with Spring WebClient - Reflectoring
How to get started using Spring WebClient to talk to REST APIs. ... As a reactive API, the request is not actually sent...
Read more >Spring WebClient Requests with Parameters - Baeldung
Learn how to reactively consume REST API endpoints with WebClient from Spring Webflux.
Read more >Web on Reactive Stack - Spring
The reactive WebClient operates in event loop style. So you can see a small, fixed number of processing threads related to that (for...
Read more >Spring WebFlux: How to Handle Errors With WebClient
In this guide, I'll show you how I like to handle errors returned by WebClient requests. Of course, you're always free to just...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thank you so much @tommysitu for you help! It works like a charm
I keep this repo public and open if anyone has the same issue.
Sorry for the delay, but here is a sample project Thanks for your help !