Skip to content
This repository was archived by the owner on Jan 21, 2020. It is now read-only.

Commit a6d51a5

Browse files
author
David Chung
authored
JSON-RPC 2.0 compliance (#310)
Signed-off-by: David Chung <[email protected]>
1 parent abd0893 commit a6d51a5

File tree

17 files changed

+272
-1480
lines changed

17 files changed

+272
-1480
lines changed

pkg/rpc/client/client.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package client
33
import (
44
"bytes"
55
log "github.com/Sirupsen/logrus"
6-
"github.com/gorilla/rpc/v2/json"
6+
"github.com/gorilla/rpc/v2/json2"
77
"net"
88
"net/http"
99
"net/http/httputil"
@@ -25,7 +25,7 @@ func New(socketPath string) Client {
2525

2626
// Call sends an RPC with a method and argument. The result must be a pointer to the response object.
2727
func (c Client) Call(method string, arg interface{}, result interface{}) error {
28-
message, err := json.EncodeClientRequest(method, arg)
28+
message, err := json2.EncodeClientRequest(method, arg)
2929
if err != nil {
3030
return err
3131
}
@@ -57,5 +57,5 @@ func (c Client) Call(method string, arg interface{}, result interface{}) error {
5757
log.Error(err)
5858
}
5959

60-
return json.DecodeClientResponse(resp.Body, result)
60+
return json2.DecodeClientResponse(resp.Body, result)
6161
}

pkg/rpc/server/server.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"time"
1010

1111
"github.com/gorilla/rpc/v2"
12-
"github.com/gorilla/rpc/v2/json"
12+
"github.com/gorilla/rpc/v2/json2"
1313
"net/http/httptest"
1414
"net/http/httputil"
1515
)
@@ -63,7 +63,7 @@ func (h loggingHandler) ServeHTTP(w http.ResponseWriter, req *http.Request) {
6363
// Returns a Stoppable that can be used to stop or block on the server.
6464
func StartPluginAtPath(socketPath string, receiver interface{}) (Stoppable, error) {
6565
server := rpc.NewServer()
66-
server.RegisterCodec(json.NewCodec(), "application/json")
66+
server.RegisterCodec(json2.NewCodec(), "application/json")
6767

6868
if err := server.RegisterService(receiver, ""); err != nil {
6969
return nil, err

vendor/github.com/gorilla/handlers/.travis.yml

Lines changed: 0 additions & 18 deletions
This file was deleted.

vendor/github.com/gorilla/handlers/LICENSE

Lines changed: 0 additions & 22 deletions
This file was deleted.

vendor/github.com/gorilla/handlers/README.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

vendor/github.com/gorilla/handlers/canonical.go

Lines changed: 0 additions & 74 deletions
This file was deleted.

vendor/github.com/gorilla/handlers/compress.go

Lines changed: 0 additions & 148 deletions
This file was deleted.

0 commit comments

Comments
 (0)