Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
    Harsh Pareek
    Hi, Is it possible to do an export of captured simulation data through API instead of CLI?
    1 reply
    Hi, Is it possible to get the value of request body which contains a key with space (ex. "Key 1":"value") using templates? Have tried with jsonpath options but no luck. @tommysitu- can you please help on this?
    2 replies
    Can anybody help with the above issue?
    Harsh Pareek
    Hi, I have setup hoverfly in proxy mode (through JVM proxy settings) and its working fine for most calls. But for one specific call the request is visible in journal when i run hoverfly in spy mode ( request goes to actual backend) but when I change the mode to simulate the request is still hitting the actual end point instead of giving captured response or failing ( if no simulation exist for it). In certain cases I am also experiencing Capture mode failing to capture few request. Has anyone faced such issues?
    2 replies
    hari avvari
    Hi , when the "encodedBody" is set to true, what kind of encoding is used ? I thought it was base64 encoding.....I exported the simulation, copied the body and tried to decode using UTF-8 character set but it doesn't decode properly...So either the body is not encoded in base64 or a different character set is being used..Can anyone help on this?
    3 replies
    Sheril Paul Vazhappilly
    Hi, I am trying to use XPath functions to capture value from the request and return it in the response. eg: string-length('hoverfly'), string(format-date(//Date/@ArrivalDate, '[M01]-[D01]-[Y0001]'))
    But it's returning blank. Can anyone help with this?
    Format I tried in response : {{ Request.Body \"xpath\" \"string-length('hoverfly')\" }}
    Hi, I am using hoverfly for our one of the microservice architecture application to record and replay the REST payload. I started the hoverfly with its root ca certificate using "./hoverfly -listen-on-host --cert ./cert.pem --key ./key.pem" where cert.pem and key.pem are located in same current directory. I then started the hoverfly in capture mode. Tried to run the POST command using curl "curl --proxy http://localhost:8500 --cacert /home/admin/Guru_Test/HoverflyTool/cert.pem -i -X POST -H 'Content-Type: application/json' -d '{"username": "admin", "password": "xxxxxxx"}' https://localhost:8443/api/v2/login". It failed with message "Hoverfly Error!
    There was an error when forwarding the request to the intended destination
    Got error: Post "https://localhost:8443/api/v2/login": x509: certificate signed by unknown authority". Could you please help to get this resolved? I cannot use "http" instead of https since our auth service is TLS enabled and I followed the link "https://docs.hoverfly.io/en/latest/pages/tutorials/advanced/configuressl/configuressl.html" This is not helping. Please let me know what I am missing
    1 reply
    Hi Is it better to use middleware to serve different responses for different types of users doing the same actions on the site or do we need to record all user interactions and let the proxy server takes care of serving it raw?
    2 replies
    I'm just starting to read the documentation hoverfly and judging by the schematics it looks like a moc server
    But is it acceptable to send recorded queries and responses in microservice instead of hoverfly?
    For regression testing
    I would like to record a history of queries on the production
    and then run it on staging, only to have the requests go to the actual microservice.
    3 replies
    Sheril Paul Vazhappilly
    @tommysitu would you be able to look into this?
    Hi, is it possible to simulate an async integration scenario with Hoverfly? I need to do a webhook (or execute any code) after the response has been returned in the calling thread
    service(baseUrl).anyMethod("/path/").willReturn(success(json(...))) //plus call another url here AND/OR execute an arbitraty code
    1 reply
    HI @JohnFDavenport Can you tell me whats the difference between spy mode and
    The destination setting applies to all Hoverfly modes. If a destination value is set while Hoverfly is running in Simulate mode, requests that are excluded by the destination setting will be passed through to the real URLs. This makes it possible to return both real and simulated responses.
    because with destination filtering you can really turn hoverfly into spy mode in a simulation mode right?
    Kishore Venkatachalam
    Hi, Is it possible to simulate https calls without adding hoverfly certificate to keystore?
    4 replies
    Lisandro Diaz
    Looking at some of the source, it seems that request body templating is only possible for json or xml, any ideas how to handle raw strings?
    1 reply
    Lisandro Diaz
    also how do you disable middleware once it set?
    1 reply

    Hi! Is there any way to get structured information when the matcher fails? I want to show the diff when the test fails: currently I show the last Hoverfly log record with error, but it's a lot of text, and I would like to highlight/show only the non-matched fields.

    I'm talking about these logs:

    Could not find a match for request, create or record a valid matcher first!
    The following request was made, but was not matched by Hoverfly:
        "Path": "/versio",
        "Method": "GET",
        "Destination": "foaas.com",
        "Scheme": "https",
        "Query": {},
        "Body": "",
        "Headers": {
            "accept": [
            "accept-encoding": [
                "gzip, deflate"
            "connection": [
            "user-agent": [
    Hi, is Hoverfly capable of recording and mocking websockets, is there an example if so ?
    Ayush khandalkar
    Hi Guys,
    I wanted to match the jsonpath matcher "body": [{
    "matcher": "jsonpath",
    "value": "$.tracingContext.correlationId?(@ == \"1234\")"
    but this validation does not seem to be working
    Is there any other go to validate jsonpath matcher to regex?
    Mahesh Rajannan

    I referred the hoverfly issue 515(SpectoLabs/hoverfly#515) and arrived at this one(https://github.com/d-lorenc/hoverfly-on-cf). I tried the same way of deploying to pcf, which is to use hoverfly start(./hoverfly -webserver) instead of hoverctl. But ./hoverfly start is NOT starting it, i can see that when trying it on a linux box separately. It only starts if i do hoverctl start.

    Can you please help us by addressing this issue ? or pointing me to correct direction. Your help is highly appreciated.

    Hi Team, I am seeing that when we use hoverfly as a proxy server in chrome the remote address header is having the hoverfly ip address value which is causing the backend to not return any data and thus we are not able to capture any data.
    I can only see this issue when we used --upstream-proxy flag when starting hoverfly @JohnFDavenport any suggestions?
    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?
    Ankita Nallana
    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.

    Ankita Nallana
    Hi folks - any examples on how to mock gRPC requests? I have the trial license
    3 replies