move 204 check to be consistent with other sources

This commit is contained in:
ben
2025-07-17 13:03:58 +01:00
parent b2f1963756
commit dcc7f4b3cd
+7 -2
View File
@@ -4,6 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"net/http"
"net/url"
"strings"
"sync"
@@ -140,8 +141,12 @@ func (s *Source) runSubsource(ctx context.Context, domain string, session *subsc
requestURL := fmt.Sprintf("%s%s?%s%s&summarize=host&summary_context=%s&summary_limit=%d", baseURL, epConfig.endpoint, epConfig.param, url.QueryEscape(domain), epConfig.context, summaryLimit)
resp, err := session.Get(ctx, requestURL, "", headers)
if err != nil {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
s.errors.Add(1)
// HTTP 204 is not an error from the Driftnet API
if resp == nil || resp.StatusCode != http.StatusNoContent {
results <- subscraping.Result{Source: s.Name(), Type: subscraping.Error, Error: err}
s.errors.Add(1)
}
wg.Done()
return
}