mock-server / mockserver

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby. MockServer also includes a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).
http://mock-server.com
Apache License 2.0
4.6k stars 1.07k forks source link

mockserver-client nodejs not working for me #469

Closed Galileo1 closed 5 years ago

Galileo1 commented 6 years ago

Hi, I am using the mockserver-client to mock a response from one of the live running site instead of local host. I have setup the properties in expectation but it doesn't seems to be working. I have mock server running at localhost:11080.And the expectation that I have attached is as following.

Can you please help?

Thanks

this.mockServerClient.mockAnyResponse({
        "httpRequest": {
          "method": "GET",
          "path": "/v1/locations/club/125th%20Street",
            "headers": {
            "Accept": ["application/json"],
            "Host": ["qa.blinkfitness.com"],
            "Referer": ["https://qa.blinkfitness.com/locations/125th-street"]
            }
        },
        "httpResponse": {
          "statusCode": 200,
          "body": 
              JSON.stringify({    
                    "id": "610",
                    "name": "Blink 125th Streetttt",
                    "shortName": "125th Streetttt",
                    "street": "301 W. 125th Streetttt",
                    "city": "New York",
                    "state": "NY",
                    "zip": "10027",
                    "approximateLocation": "Off the A, B, C or D lines at 125th street",
                    "latitude": "40.8104673",
                    "longitude": "-73.9514877",
                    "phone": "646.253.9700",
                    "clubUrl": "/locations/125th-street",
                    "joinUrl": "/join/125th-street",
                    "comingSoon": false,
                    "hours": [
                        {
                            "Days": "MON - THU",
                            "Hours": "5am to 11pm"
                        },
                        {
                            "Days": "FRI",
                            "Hours": "5am to 10pm"
                        },
                        {
                            "Days": "SAT - SUN",
                            "Hours": "7am to 7pm"
                        }
                    ],
                    "tourLatitude": "40.810549",
                    "tourLongitude": "-73.9514289",
                    "panoId": "W1l4fUMMquIAAAQfCaRKEg",
                    "clubStatus": "Open",
                    "clubEmail": "125street@blinkfitness.com"

                })
        }
      })
  }
jamesdbloom commented 5 years ago

What error are you getting?

Why do you think it doesn't work?

Can you provide more context and more of the code you are using.

jamesdbloom commented 5 years ago

there is no response to request for more information so closing this ticket, if you can provide more information please re-open or raise a new ticket.