updates API from "has" to "exists"

This commit is contained in:
Marcin Czenko 2025-10-21 16:14:12 +02:00
parent ca8b1dd5f6
commit d8b762ea06
No known key found for this signature in database
GPG Key ID: A0449219BDBA98AE
2 changed files with 2 additions and 2 deletions

View File

@ -78,7 +78,7 @@ func (c *CodexClient) LocalDownload(cid string, output io.Writer) error {
}
func (c *CodexClient) HasCid(cid string) (bool, error) {
url := fmt.Sprintf("%s/api/codex/v1/data/%s/has", c.BaseURL, cid)
url := fmt.Sprintf("%s/api/codex/v1/data/%s/exists", c.BaseURL, cid)
resp, err := c.Client.Get(url)
if err != nil {

View File

@ -158,7 +158,7 @@ func TestHasCid_Success(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
if r.URL.Path != "/api/codex/v1/data/"+tt.cid+"/has" {
if r.URL.Path != "/api/codex/v1/data/"+tt.cid+"/exists" {
w.WriteHeader(http.StatusNotFound)
return
}