Merge pull request #1024 from wangyanfu2/fix-TavilySearch-response

fix: add HTTP status code check in BraveSearchProvider
This commit is contained in:
Mauro 2026-03-03 11:42:05 +01:00 committed by GitHub
commit 4a7605ee14
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -109,6 +109,10 @@ func (p *BraveSearchProvider) Search(ctx context.Context, query string, count in
return "", fmt.Errorf("failed to read response: %w", err)
}
if resp.StatusCode != http.StatusOK {
return "", fmt.Errorf("brave api error (status %d): %s", resp.StatusCode, string(body))
}
var searchResp struct {
Web struct {
Results []struct {