https://linen.dev logo
#help
Title
# help
f

Faye Salwin

11/07/2023, 6:14 PM
Copy code
faye@ip-192-168-50-70 standalone % grpcurl -d '{"name": "Tom", "bagOfTricks": { "key":"value"}, "unknownId": "bar"}' -plaintext -proto ExampleServices.proto localhost:8000 com.example.grpc.GreetingService/greeting
{
  "greeting": "Hello Tom",
  "unknownId": "got bar"
}
faye@ip-192-168-50-70 standalone % cat wiremock-data/mappings/greeting.json
{
    "request": {
        "method": "POST",
        "urlPath": "/com.example.grpc.GreetingService/greeting"
    },

    "response": {
        "status": 200,
        "body": "{\"greeting\": \"Hello {{jsonPath request.body '$.name'}}\", \"unknown_id\": \"got {{jsonPath request.body '$.unknownId'}}\"}",
	"headers": {
            "Content-Type": "application/grpc"
        },

        "transformers": ["response-template"]
    }
}
I seem to be running across some field name usage problems - I just added an additional field named unknown_id to the example request and response as a string. The json is formed with the _ but if you use $.unknown_id it will return blank
2 Views