Assert mr API
This commit is contained in:
parent
1b68fc571f
commit
c3042c97f0
@ -2,6 +2,7 @@ package mr
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"net/url"
|
||||
@ -117,6 +118,14 @@ func GetInfo(hash string) (info Info, err error) {
|
||||
query := fmt.Sprintf("%s/file/%s/info", apiURL,
|
||||
url.QueryEscape(hash),
|
||||
)
|
||||
|
||||
err = getJson(query, &info)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if len(info.Result) != 1 {
|
||||
err = errors.New("API mismatch")
|
||||
}
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user