summaryrefslogtreecommitdiff
path: root/internal/easyhttp/easyhttp.go
diff options
context:
space:
mode:
Diffstat (limited to 'internal/easyhttp/easyhttp.go')
-rw-r--r--internal/easyhttp/easyhttp.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/internal/easyhttp/easyhttp.go b/internal/easyhttp/easyhttp.go
index ce3d53b..c44cce3 100644
--- a/internal/easyhttp/easyhttp.go
+++ b/internal/easyhttp/easyhttp.go
@@ -68,7 +68,14 @@ func Post(ctx context.Context, uri, apiKey string, data []byte) ([]byte, error)
return []byte{}, fmt.Errorf("%s: %w", uri, err)
}
- return body, nil
+ switch resp.StatusCode {
+ case 200:
+ return body, nil
+ case 401:
+ return body, fmt.Errorf("unauthorized, API key configured?")
+ default:
+ return body, fmt.Errorf("unexpected HTTP response code %d", resp.StatusCode)
+ }
}
// Submit structure as JSON to API