8000 GitHub - jrkt/grpc-json-proxy: gRPC Proxy for Postman like tools
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

jrkt/grpc-json-proxy

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

grpc-json-proxy

GRPC JSON is a proxy which allows HTTP API tools like Postman to interact with gRPC servers.

Requirements

  • grpc+json codec must be enabled on the grpc server
  • Postman must be configured to use the proxy

Configuration of the proxy and its dependencies is a three step process.

Register a JSON codec with the gRPC server. In Go, it can be automatically registered simple by adding the following import:

import _"github.com/jnewmano/grpc-json-proxy-codec"

  1. Run the grpc-json-proxy. Download pre-built binaries from https://github.com/jnewmano/grpc-json-proxy/releases/ or build from source:

go get -u github.com/jnewmano/grpc-json-proxy grpc-json-proxy

  1. Configure Postman to send requests through the proxy. Postman -> Preferences -> Proxy -> Global Proxy

Proxy Server: localhost 7001

Postman Proxy Configuration

Setup your Postman gRPC request with the following:

  1. Set request method to Post .
  2. Set the URL to http://{{ grpc server address}}/{{proto package}}.{{proto service}}/{{method}} Always use http, proxy will establish a secure connection to the gRPC server.
  3. Set the Content-Type header to application/grpc+json .
  4. Optionally add a Grpc-Insecure header set to true for an insecure connection.
  5. Set the request body to appropriate JSON for the message. For reference, generated Go code includes JSON tags on the generated message structs.

For example:

Postman Example Request

Inspired by Johan Brandhorst's grpc-json

About

gRPC Proxy for Postman like tools

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 98.9%
  • Shell 1.1%
0