Compare commits

..

2 Commits

Author SHA1 Message Date
dingjun d095834c40 update dependence 3 years ago
dingjun 26f4d757c9 update log library 3 years ago

@ -3,6 +3,6 @@ module github.com/fangdingjun/jsonrpc
go 1.13 go 1.13
require ( require (
github.com/fangdingjun/go-log v0.0.0-20190821073628-ae332053d6dc github.com/fangdingjun/go-log/v5 v5.0.0
github.com/gorilla/websocket v1.4.0 github.com/gorilla/websocket v1.4.2
) )

@ -1,6 +1,8 @@
github.com/fangdingjun/go-log v0.0.0-20190821073628-ae332053d6dc h1:Tdk7VsmsFo3d0NqHTy3SRoRnkduOxwXgR65gQsq8kXY= github.com/fangdingjun/go-log/v5 v5.0.0 h1:vdh9Bk9C4ZFL6KoO6rII73zQIyaLf7hFdBvucO/ckiE=
github.com/fangdingjun/go-log v0.0.0-20190821073628-ae332053d6dc/go.mod h1:oi7jbIScCbha6TbVzmrJP6igIHt+jcvvEgSJ7Ww1GkI= github.com/fangdingjun/go-log/v5 v5.0.0/go.mod h1:V012Oxo0/pSbccX4OFSp9MJglXwNsZo2ByBBorr7zzM=
github.com/gorilla/websocket v1.4.0 h1:WDFjx/TMzVgy9VdMMQi2K2Emtwi2QcUQsztZ/zLaH/Q= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90PveolxSbWFaJdECFbxSq0Mqo2M=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a h1:1BGLXjeY4akVXGgbC9HugT3Jv3hCI0z56oJR5vAMgBU=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=

@ -10,7 +10,7 @@ import (
"net/url" "net/url"
"sync" "sync"
log "github.com/fangdingjun/go-log" log "github.com/fangdingjun/go-log/v5"
) )
// HTTPTransport json rpc over http // HTTPTransport json rpc over http
@ -107,7 +107,7 @@ func (h *HTTPTransport) CallWithHeader(method string, args interface{}, reply in
if err = json.Unmarshal(data, &res); err != nil { if err = json.Unmarshal(data, &res); err != nil {
// non 200 response without valid json response // non 200 response without valid json response
if resp.StatusCode != http.StatusOK { if resp.StatusCode != http.StatusOK {
return fmt.Errorf("http error: %s", resp.Status) return fmt.Errorf("http error: %s, %s", resp.Status, data)
} }
return err return err
} }
@ -119,7 +119,7 @@ func (h *HTTPTransport) CallWithHeader(method string, args interface{}, reply in
// non 200 response without valid json response // non 200 response without valid json response
if res.ID == r.ID && resp.StatusCode != http.StatusOK { if res.ID == r.ID && resp.StatusCode != http.StatusOK {
return fmt.Errorf("http error: %s", resp.Status) return fmt.Errorf("http error: %s, %s", resp.Status, data)
} }
return json.Unmarshal(res.Result, &reply) return json.Unmarshal(res.Result, &reply)

@ -3,7 +3,7 @@ package jsonrpc
import ( import (
"testing" "testing"
log "github.com/fangdingjun/go-log" log "github.com/fangdingjun/go-log/v5"
) )
func TestCall(t *testing.T) { func TestCall(t *testing.T) {

@ -8,7 +8,7 @@ import (
"net/http" "net/http"
"sync" "sync"
log "github.com/fangdingjun/go-log" log "github.com/fangdingjun/go-log/v5"
"github.com/gorilla/websocket" "github.com/gorilla/websocket"
) )

Loading…
Cancel
Save