Remove the duplication of this codec code
This commit is contained in:
parent
25a6849609
commit
369c02c900
@ -1,19 +0,0 @@
|
||||
package broker
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
)
|
||||
|
||||
type jsonCodec struct{}
|
||||
|
||||
func (j jsonCodec) Marshal(v interface{}) ([]byte, error) {
|
||||
return json.Marshal(v)
|
||||
}
|
||||
|
||||
func (j jsonCodec) Unmarshal(d []byte, v interface{}) error {
|
||||
return json.Unmarshal(d, v)
|
||||
}
|
||||
|
||||
func (j jsonCodec) String() string {
|
||||
return "json"
|
||||
}
|
@ -17,6 +17,7 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/micro/go-micro/broker/codec/json"
|
||||
"github.com/micro/go-micro/errors"
|
||||
"github.com/micro/go-micro/registry"
|
||||
mls "github.com/micro/misc/lib/tls"
|
||||
@ -95,7 +96,7 @@ func newTransport(config *tls.Config) *http.Transport {
|
||||
|
||||
func newHttpBroker(opts ...Option) Broker {
|
||||
options := Options{
|
||||
Codec: jsonCodec{},
|
||||
Codec: json.NewCodec(),
|
||||
Context: context.TODO(),
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user