Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    is there a way to set the destination url for some requests received
    while using hoverfly either as webserver or proxy?
    I can't send the requests like: curl http://hoverfly.io --proxy http://proxy-ip:port
    I would like to send the request to http://proxy-ip:port and then the hoverfly itself knows that it should be send to the real service http://hoverfly.io
    3 replies
    Is it possible to make Response fields not final? Or what's correct way to modify response in hoverfly-java ? I am trying to make dynamic respone via interface SimulationPreprocessor but it looks like Response was designed not to be changed .
    Let me make it more clear.

    package io.specto.hoverfly.junit5;

    import com.fasterxml.jackson.core.JsonProcessingException;
    import com.fasterxml.jackson.databind.ObjectMapper;
    import io.specto.hoverfly.junit.core.Hoverfly;
    import io.specto.hoverfly.junit.core.SimulationPreprocessor;
    import io.specto.hoverfly.junit.core.model.*;
    import io.specto.hoverfly.junit5.api.HoverflyConfig;
    import io.specto.hoverfly.junit5.api.HoverflySimulate;
    import org.junit.jupiter.api.Test;
    import org.junit.jupiter.api.extension.ExtendWith;
    import java.time.LocalDateTime;
    import java.util.HashSet;
    import java.util.Set;

    config = @HoverflyConfig(
    simulationPreprocessor = PreProcessResponseTest.TimeSimulationPreprocessor.class
    ), source = @HoverflySimulate.Source(value = "hoverfly/test-service.json",
    type = HoverflySimulate.SourceType.CLASSPATH)
    public class PreProcessResponseTest {
    static class TimeSimulationPreprocessor implements SimulationPreprocessor {
    public void accept(Simulation simulation) {
    HoverflyData originData= simulation.getHoverflyData();
    HoverflyMetaData originMetaData=simulation.getHoverflyMetaData();
    Set<RequestResponsePair> pairs= new HashSet<>();
    .forEach(p ->

                     Response origin= p.getResponse();
                        String body =origin.getBody();
                        String replaced=    body.replace("NOW", LocalDateTime.now().toString());
                        Response rsp= new Response(origin.getStatus(),replaced,origin.isEncodedBody(),origin.isTemplated(),origin.getHeaders()
                        ObjectMapper mapper = new ObjectMapper();
                        try {
                        } catch (JsonProcessingException e) {
                        RequestResponsePair pair =new RequestResponsePair(p.getRequest(),rsp);
          //  HoverflyData  hoverflyData=new HoverflyData(pairs,simulation.getHoverflyData().getGlobalActions());
            simulation=new Simulation(new HoverflyData(pairs,simulation.getHoverflyData().getGlobalActions()), simulation.getHoverflyMetaData());
          //  simulation.setHoverflyData(hoverflyData);
            ObjectMapper mapper = new ObjectMapper();
            try {
            } catch (JsonProcessingException e) {
    void shouldUseCustomPorts(Hoverfly hoverfly) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();


    All Response class's fields are 'final' and there is no setHoverflyData method in Simulation class. So it looks there is no convenient way to modify response once loaded from json file.
    I am considering to support such scenario, when returning a response, replace a TIMESTAMP with NOW placeholder with current time instead of the time when last recorded.
    6 replies
    Any suggestion ?


    Started hoverfly using "hoverctl.exe". Can I use same instance in JAVA using "HoverflyConfig" and not starting again?

    also can I start Hoverfly instance in forever open mode (JAVA) and add simulations dynamically?
    Instance should stop upon issuing the "honverflyInstance.close();" (I mean disable auto destroy)
    Oliver Flint
    I'm new to Hoverfly. Was hoping to use it so virtualise some services we have connected to azure service bus
    Anyone have any experience with Hoverfly and ASB?
    Hello! Heard that for gRPC support we need a paid version of Hoverfly? Where can I get more info on it? @tommysitu
    2 replies
    Jonathan Rodriguez

    Hi, any experience with troubles using Hoverfly and spring webClient?

    I have this code.. but I can make works, I seems spring webClient can not be proxied by hoverfly.

            val reactorResourceFactory = ReactorResourceFactory()
                    .also { it.afterPropertiesSet() }
            val connector: ClientHttpConnector = ReactorClientHttpConnector(reactorResourceFactory
            ) { httpClient ->
    //                    .wiretap(true)
                        .option(ChannelOption.CONNECT_TIMEOUT_MILLIS, 10_000)
                        .proxy { proxy ->
            val r = WebClient
                    .filter(ExchangeFilterFunction { originalRequest, nextFilter ->
                        val clientRequest = ClientRequest.from(originalRequest)
                                .header("X-Shopify-Access-Token", "n")
                        return@ExchangeFilterFunction nextFilter.exchange(clientRequest)
                    .exchangeToMono { r -> Mono.just(r.rawStatusCode()) }
            println("$$$$$$$$$$$$ $r")
            hoverfly.verifyAll() ** fails ->

    error -> >

    ailed to resolve 'myapi' after 2 queries ; nested exception is java.net.UnknownHostException: failed to resolve 'myapi' after 2 queries 
    org.springframework.web.reactive.function.client.WebClientRequestException: failed to resolve 'myapi' after 2 queries ; nested exception is java.net.UnknownHostException: failed to resolve 'myapi' after 2 queries 
        at org.springframework.web.reactive.function.client.ExchangeFunctions$DefaultExchangeFunction.lambda$wrapException$9(ExchangeFunctions.java:141)
        Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException: 
    Error has been observed at the following site(s):
        |_ checkpoint ⇢ Request to POST http://myapi/admin [DefaultWebClient]
    Joe DeSantis
    @jarpz this is how we configure the web client(org.springframework.web.reactive.function.client.WebClient) ​for our int tests to be used with hoverfly.
    One down side to this approach that we have yet to get around... You need to manually set the port for the hoverfly instance
    @HoverflySimulate(config = @HoverflyConfig(proxyPort = HOVERFLY_PROXY_PORT))
    public class WebClientTestConfig {
       ​private static final int CONNECTION_TIMEOUT = 10000;
       ​private static final int READ_TIMEOUT = 40000;
       ​private static final int WRITE_TIMEOUT = 10000;
       ​public static final int HOVERFLY_PROXY_PORT = 49471; //RANDOM UNUSED PORT@Primary@Beanpublic static WebClient integrationTestWebClient() throws SSLException {
           ​SslContext sslContext = SslContextBuilder
           ​TcpClient tcpClient = TcpClient.create()
               ​.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, CONNECTION_TIMEOUT) // Connection Timeout
               ​.secure(contextSpec -> contextSpec.sslContext(sslContext))
               ​.proxy(proxy -> proxy.type(ProxyProvider.Proxy.HTTP).host("localhost")
               ​.doOnConnected(connection ->
                   ​connection.addHandlerLast(new ReadTimeoutHandler(READ_TIMEOUT)) // Read Timeout
                       ​.addHandlerLast(new WriteTimeoutHandler(WRITE_TIMEOUT))); // Write Timeoutreturn WebClient.builder()
               ​.clientConnector(new ReactorClientHttpConnector(HttpClient.from(tcpClient)))
    Malcolm J O'Callaghan

    hello - i am getting the following error on an api specification that validates in the swagger editor:

    >hoverctl import api.json
    Could not import simulation
    Invalid JSON, missing "meta" object

    is there a particular validation process i should follow or a standard that your import process is coded to that i should validate against?

    2 replies
    I have installed hoverfly on kubernetes by using helm. (https://docs.hoverfly.io/en/latest/pages/introduction/downloadinstallation.html#kubernetes). When i login the pod i can see hoverfly in running. But hoverctl command not working. Can anyone tell me what i am doing the wrong here
    1 reply
    Joe DeSantis
    @mkammy Just a thought, I would try just placing a copy of the hoverctl on the pod, and see how that works. IE. something like wget https://github.com/SpectoLabs/hoverfly/releases/download/v1.3.2/hoverfly_bundle_linux_amd64.zip && unzip hoverfly_bundle_linux_amd64.zip && cd hoverfly_bundle_linux_amd64 && ./hoverctl
    Have you looked into remote hoverfly hoverctl control as well? https://docs.hoverfly.io/en/latest/pages/tutorials/advanced/remotehoverfly/remotehoverfly.html
    Thanks @desantisjmd_twitter that worked. But curl command is not working in this pod. This is the deprecated version that i have installed. Can someone please share the link of latest helm chart. Thanks in advance
    Joe DeSantis
    @mkammy Try apk update && apk upgrade && apk add curl
    apoorv sharda

    Hi All,

    I am trying to capture requests using hoverfly on Docker, I am able to capture the requests using curl command by following hoverfly documentations, but i want to know if there is a way to capture all the incoming requests to that particular VM? for example how when we are setting Proxy in SoapUI when we are using hoverfly on our local and it captures all the traffic.

    Hi folks - any examples on how to mock gRPC requests? I have the trial license
    9 replies
    Hi, can anyone send me step by step instructions on how to change the default proxy port? I want to run Hoverfly as a webserver on port other than 8500
    John Davenport
    Have you tried the -pp command?
    yes, John I have but the command interface it stucks on 'Admin interface is starting'
    when I try to open another cmd interface and check status - hoverfly is still running on 8500
    Am i missing anything here?
    John Davenport
    Check that you haven’t got multiple copies of hoverfly running
    Nope, I only have one instance of Hoverfly running. Again, restarted my machine, opened cmd and checked Hoverfly status, it's stuck on 'Admin interface is starting' again
    John Davenport
    Ok, then I’m not sure
    what is the sequence of commands for changing port? start hoverfly as a webserver, change port and then import simulation?
    anyone know how to add proxy to grpcurl requests? (need this so my requests hit hoverfly)
    5 replies
    Hi @tommysitu The remote instance of hoverfly runs Proxy in forward mode, Can I run it in Reverse mode like you would on a local machine ?
    2 replies
    Anirban Das
    Hi All, I am using hoverfly-java version 0.14.0 on JDK 11/Windows 10 and could see that the HoverflyConfig class has no API (getter setter) corresponding to the specification of the option: -response-body-files-allow-origin in the hoverfly binary executable file. Is there any specific reason for its exclusion or can I expect it in some later versions of the native Java library available on Maven?
    3 replies
    Balachander Jayachandran
    Hi...Am running Hoverfly in simulate mode with a simulation template JSON file imported. I also do have a middleware defined...and i see that all requests defined in the simulation json file passes through middleware....Is it possible to capture the requests that are NOT defined in the simulation JSON in the middleware...I would like to construct the response in the middleware if the corresponding request is not part of the simulation file....plz help...
    3 replies

    Hi guys!
    I'm trying to run hoverfly as https proxy and it seems (from the documentation at least) that I must specify the certificate with every request I send.
    Is there any chance that hoverfly can do key exchange? because this means that all servers under test would have to be modified to send a request with a cert attached (good luck with that :( )


    Connor Beck
    Hello! Quick question - will there be a new release of hoverfly-java soon? There's been a number of changes committed since December 2020, including one that fixes a breaking issue with assertThatNoDiffIsReported for me, but with no official release, getting those changes is a pain.
    1 reply
    Damian Jansen
    Hey all, is it possible to start hoverfly docker with a spec imported?
    Damian Jansen
    This message was deleted
    1 reply
    Damian Jansen
    Hey all, is it possible to json match on a wildcard, or provide multiple jsonpaths?
    eg. I want to json match { { "login": { "email": "anyemail", "password": "anypassword" } }
    1 reply
    Hi everyone! New here, looking for help regarding hoverfly Golang. Namely github.com/SpectoLabs/hoverfly/core and github.com/SpectoLabs/hoverfly/hoverctl/configuration. When I do a 'go get github.com/SpectoLabs/hoverfly/hoverctl/configuration' for instance, I get 'fatal: repository 'https://github.com/daryl/zeus/' not found' for a package used by hoverfly. Any ideas/help would be useful. Thanks
    8 replies
    Hi All, is it possible to run hoverfly as windows services? Just like Jenkins. When the user logged off from the windows server the hoverctl or hoverfly tool running in command prompt is closed. Is there any solution available? Did anyone face this?

    Hi Team. We are using hoverfly for our virtualization. And facing issue. Not able to do capture mode for destination server requiring 2 way ssl authentication. The destination server is not recognizing the ssl key

    Followed steps given here https://docs.hoverfly.io/en/latest/pages/tutorials/advanced/configuressl/configuressl.html.
    1) We have pfx file, extracted the cert and key from pfx and used in capture mode.
    2) hoverctl start --pac-file corporateProxy.pac --client-authentication-client-cert certFrompfx.pem --client-authentication-client-key UnencryptedRSAkeyFromPfx.pem --client-authentication-destination https://distination.server --disable-tls

    Any suggestions ?

    1 reply

    Hey there, I have a capture/middleware use case where I want to be able to manipulate (prune) the response data. I have the middleware successfully working in modify mode, but per the documentation this does not save requests and responses (i.e. capture). And capture mode doesn't allow the middleware to affect responses (only requests). Any advice as to how best to get the best of both worlds here (middleware response data and capture)?

    Thanks in advance,