{ "request": { "path": [ { "matcher": "exact", "value": "/foobar" } ], "method": [ { "matcher": "exact", "value": "POST" } ], "destination": [ { "matcher": "exact", "value": "www.google.com" } ], "scheme": [ { "matcher": "exact", "value": "http" } ], "body": [ { "matcher": "jsonpath", "value": "$.user.id?(@==1)" } ] }, "response": { "status": 200, "body": "{ \"user\" : { \"id\": \"1\", \"name\": \"John Doe\"}}", "encodedBody": false, "headers": { "Hoverfly": [ "Was-Here" ], "Content-Type": [ "application/json;charset=UTF-8" ] }, "templated": false } }, { "request": { "path": [ { "matcher": "exact", "value": "/foobar" } ], "method": [ { "matcher": "exact", "value": "POST" } ], "destination": [ { "matcher": "exact", "value": "www.google.com" } ], "scheme": [ { "matcher": "exact", "value": "http" } ], "body": [ { "matcher": "jsonpath", "value": "$.user.id?(@==1)" } ] }, "response": { "status": 200, "body": "{ \"user\" : { \"id\": \"2\", \"name\": \"Jane Doe\"}}", "encodedBody": false, "headers": { "Hoverfly": [ "Was-Here" ], "Content-Type": [ "application/json;charset=UTF-8" ] }, "templated": false }
$ curl --request POST http://www.google.com/foobar --proxy localhost:8500 --data '{ "user" : { "id" : 1 }}' % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed100 1780 100 1756 100 24 1756 24 0:00:01 --:--:-- 0:00:01 1714kHoverfly Error!
There was an error when matching
Got error: 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": "/foobar", "Method": "POST", "Destination": "www.google.com", "Scheme": "http", "Query": {}, "Body": "{ \"user\" : { \"id\" : 1 }}", "Headers": { "Accept": [ "*/*" ], "Content-Length": [ "24" ], "Content-Type": [ "application/x-www-form-urlencoded" ], "Proxy-Connection": [ "Keep-Alive" ], "User-Agent": [ "curl/7.53.0" ] }}
Whilst Hoverfly has the following state:
{}
The matcher which came closest was:
{ "path": [ { "matcher": "exact", "value": "/foobar" } ], "method": [ { "matcher": "exact", "value": "POST" } ], "destination": [ { "matcher": "exact", "value": "www.google.com" } ], "scheme": [ { "matcher": "exact", "value": "http" } ], "body": [ { "matcher": "jsonpath", "value": "$.user.id?(@==2)" } ]}
But it did not match on the following fields:
[body]
Which if hit would have given the following response:
{ "status": 200, "body": "{ \"user\" : { \"id\": \"2\", \"name\": \"Jane Doe\"}}", "encodedBody": false, "headers": { "Content-Type": [ "application/json;charset=UTF-8" ], "Hoverfly": [ "Was-Here" ] }, "templated": false}ERRO[2018-07-26T07:49:20+03:00] Failed to parse json path query {$.user.id?(@==1)}: unrecognized character in action: U+003D '='ERRO[2018-07-26T07:49:20+03:00] Failed to parse json path query {$.user.id?(@==2)}: unrecognized character in action: U+003D '='WARN[2018-07-26T07:49:20+03:00] Failed to find matching request from simulation destination=www.google.com error=No match found method=POST path=/foobar query=map[]ERRO[2018-07-26T07:49:20+03:00] There was an error when matching error=Could not find a match for request, create or record a valid matcher first! "body": [ { "matcher": "regex", "value": "\"id\"\\s:\\s2" } ]--
You received this message because you are subscribed to the Google Groups "hoverfly" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hoverfly+u...@specto.io.
To post to this group, send email to hove...@specto.io.
To view this discussion on the web visit https://groups.google.com/a/specto.io/d/msgid/hoverfly/a33156ce-07dd-41b5-a2ca-1fe44b7ae8f8%40specto.io.