From c3042c97f00e5d8d0ad4563d67f4ddfd10db7a16 Mon Sep 17 00:00:00 2001 From: Mikhail Klementev Date: Thu, 11 May 2023 11:54:35 +0000 Subject: [PATCH] Assert mr API --- distro/debian/snapshot/mr/mr.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/distro/debian/snapshot/mr/mr.go b/distro/debian/snapshot/mr/mr.go index 5b5fd8d..dc9aaa8 100644 --- a/distro/debian/snapshot/mr/mr.go +++ b/distro/debian/snapshot/mr/mr.go @@ -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 }