Need to test for nil before regex.
This commit is contained in:
parent
21d1240502
commit
2a475d7299
2 changed files with 8 additions and 6 deletions
10
jsonfxns.go
10
jsonfxns.go
|
@ -35,10 +35,12 @@ func MarshallAndSend(rawReply Reply, w io.Writer) (string, error) {
|
|||
func jsonRpcSend(user string, password string, server string, message []byte) (*http.Response, error) {
|
||||
resp, err := http.Post("http://"+user+":"+password+"@"+server,
|
||||
"application/json", bytes.NewBuffer(message))
|
||||
// We do not want to log the username/password in the errors.
|
||||
re := regexp.MustCompile(`http://\w+:\w+`)
|
||||
errString := re.ReplaceAllString(fmt.Sprintf("%v", err), "")
|
||||
err = fmt.Errorf(errString)
|
||||
if err != nil {
|
||||
// We do not want to log the username/password in the errors.
|
||||
re := regexp.MustCompile(`http://\w+:\w+`)
|
||||
errString := re.ReplaceAllString(fmt.Sprintf("%v", err), "")
|
||||
err = fmt.Errorf(errString)
|
||||
}
|
||||
return resp, err
|
||||
}
|
||||
|
||||
|
|
|
@ -2,10 +2,10 @@
|
|||
github.com/conformal/btcjson/jsonapi.go CreateMessage 100.00% (310/310)
|
||||
github.com/conformal/btcjson/jsonfxns.go MarshallAndSend 100.00% (7/7)
|
||||
github.com/conformal/btcjson/jsonfxns.go GetRaw 100.00% (6/6)
|
||||
github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (6/6)
|
||||
github.com/conformal/btcjson/jsonapi.go jsonWithArgs 100.00% (5/5)
|
||||
github.com/conformal/btcjson/jsonfxns.go jsonRpcSend 100.00% (5/5)
|
||||
github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3)
|
||||
github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27)
|
||||
github.com/conformal/btcjson/jsonapi.go readResultCmd 40.00% (20/50)
|
||||
github.com/conformal/btcjson --------------- 90.56% (374/413)
|
||||
github.com/conformal/btcjson --------------- 90.58% (375/414)
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue