Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    John Davenport
    @JohnFDavenport
    Hi @idomiralin - we’ll look into that
    1 reply
    abjitu
    @abjitu
    Hi, Can someone please help? I need to send a templated response based on query param. so, in matcher how to check if that query param is present or not?
    abjitu
    @abjitu
    i tried using regex matcher to validate if query param has numeric value. but regex is not working but exact match is working fine. what could be the issue?
    "query": { "queryParamName": [ { "matcher": "regex", "value": "^[0-9]*$" } ] }
    abjitu
    @abjitu
    In templating is there a way to return default value if not sent in request?
    1 reply
    Yannick Schinko
    @BrainStone
    Is there a simulation builder similar to the what the cloud has but either free or not requiring a credit card?
    black-silence
    @black-silence
    Hi, I want to run hoverfly in webserver mode (because easier to configure a different API host for selected services than using a proxy) but still send responses that depend on the hostname. This feature where webserver mode drops the host is killing my case, I can't even match it in headers manually. Is there a way to prevent that? I want to mock several external APIs on one hoverfly instance that responds on several hostnames.
    2 replies
    Yannick Schinko
    @BrainStone
    Alright when using hoverfly-java I have issues getting the bodyFile setting to work. I've tried all combinations of relative paths and even absolute paths but the responses are always empty.
    Using the hoverfly binary directly works perfectly however.
    Yannick Schinko
    @BrainStone
    I found out why. The bundled version is 1.1.5. Not 1.3.1...
    Yannick Schinko
    @BrainStone
    At least that one is available in the snapshots
    Yannick Schinko
    @BrainStone
    Can anybody help with that?
    SpectoLabs/hoverfly-java#247
    amanisimpson7
    @amanisimpson7
    Hi. Is it only possible to set the matching strategy via hoverctl CLI command (--matching-strategy=first)... is it not possible to set the matching strategy upon start up of the hoverfly binare via the hoverfly command options?
    1 reply

    Hi. Is it only possible to set the matching strategy via hoverctl CLI command (--matching-strategy=first)... is it not possible to set the matching strategy upon start up of the hoverfly binare via the hoverfly command options?

    @tommysitu - are you able to help on this?

    Yannick Schinko
    @BrainStone
    @tommysitu would you be able to look into this: SpectoLabs/hoverfly-java#247
    Harsh Pareek
    @harshpare
    Hi, Is it possible to do an export of captured simulation data through API instead of CLI?
    1 reply
    ronald6776
    @ronald6776
    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
    ronald6776
    @ronald6776
    Can anybody help with the above issue?
    Harsh Pareek
    @harshpare
    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
    @hariavvari_twitter
    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
    @sheril-infy
    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')\" }}
    gurukraj
    @gurukraj
    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 0.0.0.0 --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
    raghanag
    @raghanag
    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
    vkutepov
    @vkutepov
    HI.
    I'm just starting to read the documentation hoverfly and judging by the schematics it looks like a moc server
    https://howtodoinjava.com/wp-content/uploads/2017/08/1-1.jpg
    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
    @sheril-infy
    SpectoLabs/hoverfly-java#253
    @tommysitu would you be able to look into this?
    vprudnikov
    @vprudnikov
    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
    hoverfly.simulate(dsl(
    service(baseUrl).anyMethod("/path/").willReturn(success(json(...))) //plus call another url here AND/OR execute an arbitraty code
    ))
    1 reply
    raghanag
    @raghanag
    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
    @kishorevinay_twitter
    Hi, Is it possible to simulate https calls without adding hoverfly certificate to keystore?
    4 replies
    Lisandro Diaz
    @lisandrod_gitlab
    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
    @lisandrod_gitlab
    also how do you disable middleware once it set?
    1 reply
    Alexey
    @WouldYouKindly

    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": [
                "application/json"
            ],
            "accept-encoding": [
                "gzip, deflate"
            ],
            "connection": [
                "keep-alive"
            ],
            "user-agent": [
                "python-requests/2.25.1"
            ]
        }
    }
    DavidLivingston
    @DavidLivingston
    Hi, is Hoverfly capable of recording and mocking websockets, is there an example if so ?
    Ayush khandalkar
    @KhandalkarAyush_twitter
    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
    @maheshrajannan:matrix.org
    [m]

    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.

    raghanag
    @raghanag
    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.
    raghanag
    @raghanag
    I can only see this issue when we used --upstream-proxy flag when starting hoverfly @JohnFDavenport any suggestions?
    renanhguerra
    @renanhguerra
    Hello
    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
    patown
    @patown
    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 .
    patown
    @patown
    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;

    @HoverflySimulate(
    config = @HoverflyConfig(
    simulationPreprocessor = PreProcessResponseTest.TimeSimulationPreprocessor.class
    ), source = @HoverflySimulate.Source(value = "hoverfly/test-service.json",
    type = HoverflySimulate.SourceType.CLASSPATH)
    )
    @ExtendWith({HoverflyExtension.class})
    public class PreProcessResponseTest {
    static class TimeSimulationPreprocessor implements SimulationPreprocessor {
    @Override
    public void accept(Simulation simulation) {
    HoverflyData originData= simulation.getHoverflyData();
    HoverflyMetaData originMetaData=simulation.getHoverflyMetaData();
    Set<RequestResponsePair> pairs= new HashSet<>();
    originData.getPairs().stream()
    .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()
                        ,origin.getTransitionsState(),origin.getRemovesState(),origin.getFixedDelay(),origin.getLogNormalDelay());
    
                        origin=rsp;
    
                        ObjectMapper mapper = new ObjectMapper();
                        try {
                            System.out.println(mapper.writeValueAsString(origin));
                            System.out.println(mapper.writeValueAsString(rsp));
                        } catch (JsonProcessingException e) {
                            e.printStackTrace();
                        }
                        RequestResponsePair pair =new RequestResponsePair(p.getRequest(),rsp);
                        pairs.add(pair);
                    });
          //  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 {
                System.out.println("class::\n"+mapper.writeValueAsString(simulation));
            } catch (JsonProcessingException e) {
                e.printStackTrace();
            }
        }
    
    }
    @Test
    void shouldUseCustomPorts(Hoverfly hoverfly) throws JsonProcessingException {
        ObjectMapper mapper = new ObjectMapper();
        System.out.println("test::\n"+mapper.writeValueAsString(hoverfly.getSimulation()));
    }

    }

    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.
    patown
    @patown
    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 ?
    patown
    @patown
    @tommysitu
    kumar275
    @kumar275:matrix.org
    [m]

    Hi,

    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)