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.

Request for Webflux WebClient not captured

See original GitHub issue

Description 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:closed
  • Created 2 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
Universemulcommented, Nov 23, 2021

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.

1reaction
Universemulcommented, Nov 18, 2021

Sorry for the delay, but here is a sample project Thanks for your help !

Read more comments on GitHub >

github_iconTop 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 >

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