grpc-ditto

command module
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 27, 2022 License: MIT Imports: 33 Imported by: 0

README

Overview

grpc-ditto is grpc mocking server that can mock any grpc services by parsing corresponding proto file.

Usage example:

grpc-ditto --proto myprotodir --mocks jsonmocksdir

this command will run a server on port 51000 by default, parse all proto files in --proto directory, load all mocks from json files in --mocks directory and also expose grpc reflection service.

Mock format
[
  {
    "request": {
      "method": "/greet.Greeter/SayHello",
      "body_patterns": [
        {
          "matches_jsonpath": { "expression": "$.name", "eq": "Bob" }
        }
      ]
    },
    "response": {
      "body": { "message": "hello Bob" }
    }
  },
  {
    "request": {
      "method": "/greet.Greeter/SayHello",
      "body_patterns": [
        {
          "matches_jsonpath": { "expression": "$.name", "eq": "John" }
        }
      ]
    },
    "response": [
      {
        "status": {
          "code": "NOT_FOUND",
          "message": "user not found"
        }
      }
    ]
  }
]

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
fs

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL