Closed bobruub closed 3 years ago
Clearly I understand little of gRPC so did a bit of reading and a bit of time messing with the impostor code and managed to get it working. :)
The code below works just fine.
Now to figure out how to get injection code to work 👍
{
"protocol": "grpc",
"port": 5050,
"loglevel": "debug",
"recordRequests": true,
"_note_services": "need the name of the package, service and protofile location for this to load",
"services": {
"example.ExampleService": {
"file": "/Users/tim/mountebank-grpc/src/protos/example.proto"
}
},
"options": {
"protobufjs": {
"_note": "any options to protobufjs",
"includeDirs": ""
}
},
"stubs": [{
"predicates": [{
"contains": {
"path": "UnaryUnary"
},
"caseSensitive": false
}],
"responses": [
{
"is": {
"value": {
"_note": "gRPC mock unary call response",
"_note_streaming": "this is a unary/unary call, streaming requests need the value to be an array",
"id": 100,
"data": "mock response"
},
"metadata": {
"_note": "gRPC mock initial/trailing metadata response",
"initial": {
"metadata-initial-key": "metadata-initial-value"
},
"trailing": {
"metadata-trailing-key": "metadata-trailing-value"
}
}
}
}
]
}]
}
Hi,
I'm a big mountebank API user and as my company is moving towards gRCP I'd thought I'd get ahead of the development and have setup a simple service to learn more about it..
I believe I have configured it correctly but it is failing when I send a message :(
Any advice would be appreciated.
Problem: Request is returning
Setup
protocols.json
Imposters (loaded successfully via postman)
Request (loaded via bloomRPC to 127.0.0.1:5050)
Response:
mb.log
{"message":"[mb:2525] Loaded custom protocol grpc","level":"info","timestamp":"2021-07-02T06:50:56.496Z"} {"message":"[mb:2525] mountebank v2.4.0 now taking orders - point your browser to http://localhost:2525/ for help","level":"info","timestamp":"2021-07-02T06:50:56.529Z"} {"message":"[mb:2525] POST /imposters","level":"info","timestamp":"2021-07-02T06:51:02.461Z"} {"message":"[grpc:5050] Open for business...","level":"info","timestamp":"2021-07-02T06:51:02.681Z"} {"message":"[grpc:5050] [2021-07-02T06:51:02.679Z] server started on port '5050'","level":"info","timestamp":"2021-07-02T06:51:02.689Z"}