aboutsummaryrefslogtreecommitdiff
path: root/reqres.go
diff options
context:
space:
mode:
authorRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-25 13:01:03 +0100
committerRasmus Dahlberg <rasmus.dahlberg@kau.se>2020-11-25 13:01:03 +0100
commit2a442c1997cbd5b125a47727c86ecb14a27d1c01 (patch)
tree449a9fa23a4e0c0541c959f788028287b8bb6eda /reqres.go
parent2391eaeb19c810df86af7591af1575a6d6eb5d4b (diff)
fixed file typo and added more tests
- Added missing continue in TestNewGetEntries(), and checked all values in the returned request - Added TestNewGetProofByHashResponse()
Diffstat (limited to 'reqres.go')
-rw-r--r--reqres.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/reqres.go b/reqres.go
index 8e1c454..14729ea 100644
--- a/reqres.go
+++ b/reqres.go
@@ -114,12 +114,15 @@ func (lp *LogParameters) newGetProofByHashRequest(httpRequest *http.Request) (*G
return nil, fmt.Errorf("bad tree_size parameter: %v", err)
}
if size < 1 {
- return nil, fmt.Errorf("bad tree_size parameter: negative value")
+ return nil, fmt.Errorf("bad tree_size parameter: must be larger than zero")
}
hash, err := deb64(httpRequest.FormValue("hash"))
if err != nil {
return nil, fmt.Errorf("bad hash parameter: %v", err)
}
+ if len(hash) != lp.HashType.Size() {
+ return nil, fmt.Errorf("bad hash parameter: must be %d bytes", lp.HashType.Size())
+ }
return &GetProofByHashRequest{TreeSize: size, Hash: hash}, nil
}