diff --git a/client/client.go b/client/client.go index 07e16ab..f8d841a 100644 --- a/client/client.go +++ b/client/client.go @@ -10,6 +10,7 @@ import ( "mime/multipart" "net/http" "net/url" + "strings" ) const ( @@ -114,6 +115,10 @@ func (ac *AlpaconClient) sendRequest(req *http.Request) ([]byte, error) { } defer resp.Body.Close() + if !strings.Contains(resp.Header.Get("Content-Type"), "application/json") { + return nil, fmt.Errorf("Server error or incorrect request detected") + } + respBody, err := io.ReadAll(resp.Body) if err != nil { return nil, err