Remove the duplication of this codec code

This commit is contained in:
Asim Aslam 2016-12-06 19:07:11 +00:00
parent 25a6849609
commit 369c02c900
2 changed files with 2 additions and 20 deletions

View File

@ -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"
}

View File

@ -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(),
}