Documentation ¶
Index ¶
- Constants
- Variables
- func LocalRequestHandler(w http.ResponseWriter, r *http.Request)
- func NewClient(opts client.Options) (client.ProtocolClient, error)
- func RecordStatus(inv *invocation.Invocation, statusCode int)
- func RemoteRequestHandler(w http.ResponseWriter, r *http.Request)
- func WriteErrorResponse(inv *invocation.Invocation, w http.ResponseWriter, r *http.Request, ...)
- type Client
Constants ¶
View Source
const ( //SchemaHTTP represents the http schema SchemaHTTP = "http" //SchemaHTTPS represents the https schema SchemaHTTPS = "https" )
View Source
const ( XForwardedPort = "X-Forwarded-Port" XForwardedHost = "X-Forwarded-Host" )
constants for headers
View Source
const (
Name = "grpc"
)
Variables ¶
View Source
var ( ErrInvalidResp = errors.New("rest consumer response arg is not *http.Response type") //ErrCanceled means Request is canceled by context management ErrCanceled = errors.New("request cancelled") )
ErrInvalidResp invalid input
View Source
var ( //ErrRestFaultAbort is a variable of type error ErrRestFaultAbort = errors.New("injecting abort") //ErrRestFault is a variable of type error ErrRestFault = errors.New("injecting abort and delay") //ErrNilResponse is a variable of type error ErrNilResponse = errors.New("http response is nil") )
Functions ¶
func LocalRequestHandler ¶
func LocalRequestHandler(w http.ResponseWriter, r *http.Request)
LocalRequestHandler is for request from local
func NewClient ¶
func NewClient(opts client.Options) (client.ProtocolClient, error)
NewClient return a new client of grpc
func RecordStatus ¶
func RecordStatus(inv *invocation.Invocation, statusCode int)
RecordStatus record an operation status
func RemoteRequestHandler ¶
func RemoteRequestHandler(w http.ResponseWriter, r *http.Request)
RemoteRequestHandler is for request from remote
func WriteErrorResponse ¶
func WriteErrorResponse(inv *invocation.Invocation, w http.ResponseWriter, r *http.Request, statusCode int, err error)
WriteErrorResponse return proxy errors, not err from real service
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a grpc client
func (*Client) Call ¶
func (c *Client) Call(ctx context.Context, addr string, inv *invocation.Invocation, rsp interface{}) error
Call is a method which uses grpc protocol to transfer invocation
func (*Client) ReloadConfigs ¶
ReloadConfigs reload config
Click to show internal directories.
Click to hide internal directories.