Delete references to json.RawMessage (#12)
This commit is contained in:
parent
620796528e
commit
ceba64b971
|
|
@ -427,7 +427,7 @@ func (*handler) OnSendHeaders(md metadata.MD) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) getRequestData() (json.RawMessage, error) {
|
func (h *handler) getRequestData() ([]byte, error) {
|
||||||
// we don't use a mutex, though this methods will be called from different goroutine
|
// we don't use a mutex, though this methods will be called from different goroutine
|
||||||
// than other methods for bidi calls, because this method does not share any state
|
// than other methods for bidi calls, because this method does not share any state
|
||||||
// with the other methods.
|
// with the other methods.
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import (
|
||||||
"crypto/tls"
|
"crypto/tls"
|
||||||
"crypto/x509"
|
"crypto/x509"
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
"encoding/json"
|
|
||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
|
|
@ -275,7 +274,7 @@ type InvocationEventHandler interface {
|
||||||
// RequestMessageSupplier is a function that is called to retrieve request
|
// RequestMessageSupplier is a function that is called to retrieve request
|
||||||
// messages for a GRPC operation. The message contents must be valid JSON. If
|
// messages for a GRPC operation. The message contents must be valid JSON. If
|
||||||
// the supplier has no more messages, it should return nil, io.EOF.
|
// the supplier has no more messages, it should return nil, io.EOF.
|
||||||
type RequestMessageSupplier func() (json.RawMessage, error)
|
type RequestMessageSupplier func() ([]byte, error)
|
||||||
|
|
||||||
// InvokeRpc uses te given GRPC connection to invoke the given method. The given descriptor source
|
// InvokeRpc uses te given GRPC connection to invoke the given method. The given descriptor source
|
||||||
// is used to determine the type of method and the type of request and response message. The given
|
// is used to determine the type of method and the type of request and response message. The given
|
||||||
|
|
@ -406,7 +405,7 @@ func invokeClientStream(ctx context.Context, stub grpcdynamic.Stub, md *desc.Met
|
||||||
// Upload each request message in the stream
|
// Upload each request message in the stream
|
||||||
var resp proto.Message
|
var resp proto.Message
|
||||||
for err == nil {
|
for err == nil {
|
||||||
var data json.RawMessage
|
var data []byte
|
||||||
data, err = requestData()
|
data, err = requestData()
|
||||||
if err == io.EOF {
|
if err == io.EOF {
|
||||||
resp, err = str.CloseAndReceive()
|
resp, err = str.CloseAndReceive()
|
||||||
|
|
@ -528,7 +527,7 @@ func invokeBidi(ctx context.Context, cancel context.CancelFunc, stub grpcdynamic
|
||||||
|
|
||||||
// Concurrently upload each request message in the stream
|
// Concurrently upload each request message in the stream
|
||||||
var err error
|
var err error
|
||||||
var data json.RawMessage
|
var data []byte
|
||||||
for err == nil {
|
for err == nil {
|
||||||
data, err = requestData()
|
data, err = requestData()
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,6 @@
|
||||||
package grpcurl_test
|
package grpcurl_test
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"encoding/json"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"net"
|
"net"
|
||||||
|
|
@ -568,7 +567,7 @@ type handler struct {
|
||||||
respTrailersCount int
|
respTrailersCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) getRequestData() (json.RawMessage, error) {
|
func (h *handler) getRequestData() ([]byte, error) {
|
||||||
// we don't use a mutex, though this method will be called from different goroutine
|
// we don't use a mutex, though this method will be called from different goroutine
|
||||||
// than other methods for bidi calls, because this method does not share any state
|
// than other methods for bidi calls, because this method does not share any state
|
||||||
// with the other methods.
|
// with the other methods.
|
||||||
|
|
@ -580,7 +579,7 @@ func (h *handler) getRequestData() (json.RawMessage, error) {
|
||||||
// insert delay between messages in request stream
|
// insert delay between messages in request stream
|
||||||
time.Sleep(time.Millisecond * 50)
|
time.Sleep(time.Millisecond * 50)
|
||||||
}
|
}
|
||||||
return json.RawMessage(h.reqMessages[h.reqMessagesCount-1]), nil
|
return []byte(h.reqMessages[h.reqMessagesCount-1]), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *handler) OnResolveMethod(md *desc.MethodDescriptor) {
|
func (h *handler) OnResolveMethod(md *desc.MethodDescriptor) {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue