Skip to content

Commit

Permalink
Merge branch 'release/12.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
AdamSLevy committed Sep 12, 2019
2 parents 960115e + b5525c4 commit 7c371a0
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion README.md
@@ -1,4 +1,4 @@
# jsonrpc2/v11
# jsonrpc2/v12
[![GoDoc](https://godoc.org/github.com/AdamSLevy/jsonrpc2?status.svg)](https://godoc.org/github.com/AdamSLevy/jsonrpc2)
[![Go Report Card](https://goreportcard.com/badge/github.com/AdamSLevy/jsonrpc2)](https://goreportcard.com/report/github.com/AdamSLevy/jsonrpc2)
[![Coverage Status](https://coveralls.io/repos/github/AdamSLevy/jsonrpc2/badge.svg?branch=master)](https://coveralls.io/github/AdamSLevy/jsonrpc2?branch=master)
Expand Down
21 changes: 19 additions & 2 deletions client.go
Expand Up @@ -11,15 +11,32 @@ import (
"os"
)

// Logger allows custom log types to be used with the Client when
// Client.DebugRequest is true.
type Logger interface {
Println(...interface{})
}

// RequestDoer is implemented by *http.Client and many other Client types are
// easily adapted to match this interface. This allows a custom HTTP Client
// type to be used with Client.
type RequestDoer interface {
Do(req *http.Request) (*http.Response, error)
}

// NewClient returns a newly initialized Client. If doer is nil, then
// &http.Client{} is used.
func NewClient(doer RequestDoer) *Client {
if doer == nil {
doer = &http.Client{}
}
return &Client{RequestDoer: doer}
}

// Client embeds http.Client and provides a convenient way to make JSON-RPC
// requests.
type Client struct {
http.Client

RequestDoer
DebugRequest bool
Log Logger

Expand Down
9 changes: 3 additions & 6 deletions go.mod
@@ -1,8 +1,5 @@
module github.com/AdamSLevy/jsonrpc2/v11
module github.com/AdamSLevy/jsonrpc2/v12

go 1.12
go 1.13

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/stretchr/testify v1.3.0
)
require github.com/stretchr/testify v1.3.0
2 changes: 0 additions & 2 deletions go.sum
@@ -1,7 +1,5 @@
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
Expand Down

0 comments on commit 7c371a0

Please sign in to comment.