Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Bind = gin.Bind
View Source
var ForwardResponseMessage = func(ctx *gin.Context, md grpc.ServerMetadata, message proto.Message) { if !message.ProtoReflect().IsValid() { ginx.Respond(ctx, &response.ErrResp{}) return } err := gateway.ForwardResponseMessage(ctx.Writer, ctx.Request, md, message, gateway.DefaultMarshal) if err != nil { HttpError(ctx, err) return } }
View Source
var HttpError = func(ctx *gin.Context, err error) { s, ok := status.FromError(err) if !ok { grpclog.Warningf("Failed to convert error to status: %v", err) } delete(ctx.Request.Header, httpx.HeaderTrailer) errcodeHeader := strconv.Itoa(int(s.Code())) buf, contentType := gateway.DefaultMarshal(ctx, s) ctx.Header(httpx.HeaderContentType, contentType) ctx.Header(httpx.HeaderGrpcStatus, errcodeHeader) ctx.Header(httpx.HeaderErrorCode, errcodeHeader) if _, err := ctx.Writer.Write(buf); err != nil { grpclog.Infof("Failed to write response: %v", err) } }
View Source
var Marshaler = gatewayx.DefaultMarshal
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.