Documentation ¶
Index ¶
- Variables
- func ErrorFromHTTPResponse(resp *HTTPResponse) error
- func Errorf(code int, tmpl string, args ...interface{}) error
- func RegisterHTTPServer(s grpc.ServiceRegistrar, srv HTTPServer)
- type HTTPClient
- type HTTPRequest
- func (*HTTPRequest) Descriptor() ([]byte, []int)deprecated
- func (x *HTTPRequest) GetBody() []byte
- func (x *HTTPRequest) GetHeaders() []*Header
- func (x *HTTPRequest) GetMethod() string
- func (x *HTTPRequest) GetUrl() string
- func (m *HTTPRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *HTTPRequest) MarshalToVT(dAtA []byte) (int, error)
- func (m *HTTPRequest) MarshalVT() (dAtA []byte, err error)
- func (*HTTPRequest) ProtoMessage()
- func (x *HTTPRequest) ProtoReflect() protoreflect.Message
- func (x *HTTPRequest) Reset()
- func (m *HTTPRequest) SizeVT() (n int)
- func (x *HTTPRequest) String() string
- func (m *HTTPRequest) UnmarshalVT(dAtA []byte) error
- type HTTPResponse
- func (*HTTPResponse) Descriptor() ([]byte, []int)deprecated
- func (x *HTTPResponse) GetBody() []byte
- func (x *HTTPResponse) GetCode() int32
- func (x *HTTPResponse) GetHeaders() []*Header
- func (m *HTTPResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *HTTPResponse) MarshalToVT(dAtA []byte) (int, error)
- func (m *HTTPResponse) MarshalVT() (dAtA []byte, err error)
- func (*HTTPResponse) ProtoMessage()
- func (x *HTTPResponse) ProtoReflect() protoreflect.Message
- func (x *HTTPResponse) Reset()
- func (m *HTTPResponse) SizeVT() (n int)
- func (x *HTTPResponse) String() string
- func (m *HTTPResponse) UnmarshalVT(dAtA []byte) error
- type HTTPServer
- type Header
- func (*Header) Descriptor() ([]byte, []int)deprecated
- func (x *Header) GetKey() string
- func (x *Header) GetValues() []string
- func (m *Header) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Header) MarshalToVT(dAtA []byte) (int, error)
- func (m *Header) MarshalVT() (dAtA []byte, err error)
- func (*Header) ProtoMessage()
- func (x *Header) ProtoReflect() protoreflect.Message
- func (x *Header) Reset()
- func (m *Header) SizeVT() (n int)
- func (x *Header) String() string
- func (m *Header) UnmarshalVT(dAtA []byte) error
- type UnimplementedHTTPServer
- type UnsafeHTTPServer
Constants ¶
This section is empty.
Variables ¶
var ( ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling") ErrIntOverflow = fmt.Errorf("proto: integer overflow") ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group") )
var File_util_httpgrpc_httpgrpc_proto protoreflect.FileDescriptor
var HTTP_ServiceDesc = grpc.ServiceDesc{ ServiceName: "httpgrpc.HTTP", HandlerType: (*HTTPServer)(nil), Methods: []grpc.MethodDesc{ { MethodName: "Handle", Handler: _HTTP_Handle_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "util/httpgrpc/httpgrpc.proto", }
HTTP_ServiceDesc is the grpc.ServiceDesc for HTTP service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)
Functions ¶
func ErrorFromHTTPResponse ¶
func ErrorFromHTTPResponse(resp *HTTPResponse) error
ErrorFromHTTPResponse converts an HTTP response into a grpc error
func Errorf ¶
Errorf returns a HTTP gRPC error than is correctly forwarded over gRPC, and can eventually be converted back to a HTTP response with HTTPResponseFromError.
func RegisterHTTPServer ¶
func RegisterHTTPServer(s grpc.ServiceRegistrar, srv HTTPServer)
Types ¶
type HTTPClient ¶
type HTTPClient interface {
Handle(ctx context.Context, in *HTTPRequest, opts ...grpc.CallOption) (*HTTPResponse, error)
}
HTTPClient is the client API for HTTP service.
For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
func NewHTTPClient ¶
func NewHTTPClient(cc grpc.ClientConnInterface) HTTPClient
type HTTPRequest ¶
type HTTPRequest struct { Method string `protobuf:"bytes,1,opt,name=method,proto3" json:"method,omitempty"` Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"` Headers []*Header `protobuf:"bytes,3,rep,name=headers,proto3" json:"headers,omitempty"` Body []byte `protobuf:"bytes,4,opt,name=body,proto3" json:"body,omitempty"` // contains filtered or unexported fields }
func (*HTTPRequest) Descriptor
deprecated
func (*HTTPRequest) Descriptor() ([]byte, []int)
Deprecated: Use HTTPRequest.ProtoReflect.Descriptor instead.
func (*HTTPRequest) GetBody ¶
func (x *HTTPRequest) GetBody() []byte
func (*HTTPRequest) GetHeaders ¶
func (x *HTTPRequest) GetHeaders() []*Header
func (*HTTPRequest) GetMethod ¶
func (x *HTTPRequest) GetMethod() string
func (*HTTPRequest) GetUrl ¶
func (x *HTTPRequest) GetUrl() string
func (*HTTPRequest) MarshalToSizedBufferVT ¶
func (m *HTTPRequest) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*HTTPRequest) MarshalToVT ¶
func (m *HTTPRequest) MarshalToVT(dAtA []byte) (int, error)
func (*HTTPRequest) MarshalVT ¶
func (m *HTTPRequest) MarshalVT() (dAtA []byte, err error)
func (*HTTPRequest) ProtoMessage ¶
func (*HTTPRequest) ProtoMessage()
func (*HTTPRequest) ProtoReflect ¶
func (x *HTTPRequest) ProtoReflect() protoreflect.Message
func (*HTTPRequest) Reset ¶
func (x *HTTPRequest) Reset()
func (*HTTPRequest) SizeVT ¶
func (m *HTTPRequest) SizeVT() (n int)
func (*HTTPRequest) String ¶
func (x *HTTPRequest) String() string
func (*HTTPRequest) UnmarshalVT ¶
func (m *HTTPRequest) UnmarshalVT(dAtA []byte) error
type HTTPResponse ¶
type HTTPResponse struct { Code int32 `protobuf:"varint,1,opt,name=Code,proto3" json:"Code,omitempty"` Headers []*Header `protobuf:"bytes,2,rep,name=headers,proto3" json:"headers,omitempty"` Body []byte `protobuf:"bytes,3,opt,name=body,proto3" json:"body,omitempty"` // contains filtered or unexported fields }
func HTTPResponseFromError ¶
func HTTPResponseFromError(err error) (*HTTPResponse, bool)
HTTPResponseFromError converts a grpc error into an HTTP response
func (*HTTPResponse) Descriptor
deprecated
func (*HTTPResponse) Descriptor() ([]byte, []int)
Deprecated: Use HTTPResponse.ProtoReflect.Descriptor instead.
func (*HTTPResponse) GetBody ¶
func (x *HTTPResponse) GetBody() []byte
func (*HTTPResponse) GetCode ¶
func (x *HTTPResponse) GetCode() int32
func (*HTTPResponse) GetHeaders ¶
func (x *HTTPResponse) GetHeaders() []*Header
func (*HTTPResponse) MarshalToSizedBufferVT ¶
func (m *HTTPResponse) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*HTTPResponse) MarshalToVT ¶
func (m *HTTPResponse) MarshalToVT(dAtA []byte) (int, error)
func (*HTTPResponse) MarshalVT ¶
func (m *HTTPResponse) MarshalVT() (dAtA []byte, err error)
func (*HTTPResponse) ProtoMessage ¶
func (*HTTPResponse) ProtoMessage()
func (*HTTPResponse) ProtoReflect ¶
func (x *HTTPResponse) ProtoReflect() protoreflect.Message
func (*HTTPResponse) Reset ¶
func (x *HTTPResponse) Reset()
func (*HTTPResponse) SizeVT ¶
func (m *HTTPResponse) SizeVT() (n int)
func (*HTTPResponse) String ¶
func (x *HTTPResponse) String() string
func (*HTTPResponse) UnmarshalVT ¶
func (m *HTTPResponse) UnmarshalVT(dAtA []byte) error
type HTTPServer ¶
type HTTPServer interface { Handle(context.Context, *HTTPRequest) (*HTTPResponse, error) // contains filtered or unexported methods }
HTTPServer is the server API for HTTP service. All implementations must embed UnimplementedHTTPServer for forward compatibility
type Header ¶
type Header struct { Key string `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"` Values []string `protobuf:"bytes,2,rep,name=values,proto3" json:"values,omitempty"` // contains filtered or unexported fields }
func (*Header) Descriptor
deprecated
func (*Header) MarshalToSizedBufferVT ¶
func (*Header) ProtoMessage ¶
func (*Header) ProtoMessage()
func (*Header) ProtoReflect ¶
func (x *Header) ProtoReflect() protoreflect.Message
func (*Header) UnmarshalVT ¶
type UnimplementedHTTPServer ¶
type UnimplementedHTTPServer struct { }
UnimplementedHTTPServer must be embedded to have forward compatible implementations.
func (UnimplementedHTTPServer) Handle ¶
func (UnimplementedHTTPServer) Handle(context.Context, *HTTPRequest) (*HTTPResponse, error)
type UnsafeHTTPServer ¶
type UnsafeHTTPServer interface {
// contains filtered or unexported methods
}
UnsafeHTTPServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to HTTPServer will result in compilation errors.