diff --git a/README.md b/README.md index 8f9bf58d..88a574dd 100644 --- a/README.md +++ b/README.md @@ -58,7 +58,8 @@ $ go get github.com/conformal/btcjson ## TODO - Add data structures for remaining commands. -- Increase test coverage to 100% +- Increase test coverage to 100%. +- Add https support. ## GPG Verification Key diff --git a/internal_test.go b/internal_test.go index 7a4d9268..665618e6 100644 --- a/internal_test.go +++ b/internal_test.go @@ -35,8 +35,11 @@ var resulttests = []struct { {"getinfo", []byte(`{"error":null,"result":null}`), false, false}, {"getinfo", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getblock", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getblock", []byte(`{"result":{"hash":"000000","confirmations":16007,"size":325648},"error":null,"id":1}`), false, true}, {"getrawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"getrawtransaction", []byte(`{"error":null,"id":1,"result":{"hex":"somejunk","version":1}}`), false, true}, {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, + {"decoderawtransaction", []byte(`{"error":null,"id":1,"result":{"Txid":"something"}}`), false, true}, {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":[{"a":"b"}]}`), false, false}, {"getaddressesbyaccount", []byte(`{"error":null,"id":1,"result":["test"]}`), false, true}, } diff --git a/jsonapi.go b/jsonapi.go index 42f30efe..e07d5aa0 100644 --- a/jsonapi.go +++ b/jsonapi.go @@ -674,8 +674,8 @@ func readResultCmd(cmd string, message []byte) (Reply, error) { } result.Result = res // For commands that return a single item, we get it with the - // correct concrete type for free (but treat them seperately - // for clarity. + // correct concrete type for free (but treat them separately + // for clarity). case "getblockcount": err = json.Unmarshal(message, &result) if err != nil { diff --git a/test_coverage.txt b/test_coverage.txt index 2ca69f2a..4c58d3ec 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -6,7 +6,7 @@ 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/jsonapi.go jsonWithArgs 100.00% (5/5) github.com/conformal/btcjson/jsonapi.go IsValidIdType 100.00% (3/3) -github.com/conformal/btcjson/jsonapi.go readResultCmd 85.00% (51/60) +github.com/conformal/btcjson/jsonapi.go readResultCmd 90.16% (55/61) github.com/conformal/btcjson/jsonapi.go RpcCommand 66.67% (18/27) -github.com/conformal/btcjson --------------- 95.91% (422/440) +github.com/conformal/btcjson --------------- 96.60% (426/441)