mirror of
https://github.com/btcsuite/btcd.git
synced 2025-02-22 06:21:50 +01:00
Default to JSONRPC 1.0 if the rpcVersion empty
This commit is contained in:
parent
074266215c
commit
71c844310a
1 changed files with 3 additions and 0 deletions
|
@ -157,6 +157,9 @@ func (request *Request) UnmarshalJSON(b []byte) error {
|
|||
// request.
|
||||
func NewRequest(rpcVersion RPCVersion, id interface{}, method string, params []interface{}) (*Request, error) {
|
||||
// default to JSON-RPC 1.0 if RPC type is not specified
|
||||
if rpcVersion == "" {
|
||||
rpcVersion = RpcVersion1
|
||||
}
|
||||
if !rpcVersion.IsValid() {
|
||||
str := fmt.Sprintf("rpcversion '%s' is invalid", rpcVersion)
|
||||
return nil, makeError(ErrInvalidType, str)
|
||||
|
|
Loading…
Add table
Reference in a new issue