@@ -188,7 +188,7 @@ func TestBuildFromConfig_Bearer(t *testing.T) {
188188 URL : & url.URL {Host : "api.openai.com" },
189189 Header : make (http.Header ),
190190 }
191- if ! store .InjectCredentials (req ) {
191+ if matched , injected := store .InjectCredentials (req ); ! matched || ! injected {
192192 t .Error ("should match api.openai.com" )
193193 }
194194 if got := req .Header .Get ("Authorization" ); got != "Bearer sk-test-123" {
@@ -216,7 +216,7 @@ func TestBuildFromConfig_APIKey(t *testing.T) {
216216 URL : & url.URL {Host : "api.anthropic.com" },
217217 Header : make (http.Header ),
218218 }
219- if ! store .InjectCredentials (req ) {
219+ if matched , injected := store .InjectCredentials (req ); ! matched || ! injected {
220220 t .Error ("should match api.anthropic.com" )
221221 }
222222 if got := req .Header .Get ("x-api-key" ); got != "sk-ant-test" {
@@ -244,7 +244,7 @@ func TestBuildFromConfig_GitHubBearer(t *testing.T) {
244244 URL : & url.URL {Host : "github.com" },
245245 Header : make (http.Header ),
246246 }
247- if ! store .InjectCredentials (req ) {
247+ if matched , injected := store .InjectCredentials (req ); ! matched || ! injected {
248248 t .Error ("should match github.com" )
249249 }
250250 if got := req .Header .Get ("Authorization" ); got != "Bearer ghp_test" {
@@ -256,7 +256,7 @@ func TestBuildFromConfig_GitHubBearer(t *testing.T) {
256256 URL : & url.URL {Host : "raw.githubusercontent.com" },
257257 Header : make (http.Header ),
258258 }
259- if ! store .InjectCredentials (req2 ) {
259+ if matched , injected := store .InjectCredentials (req2 ); ! matched || ! injected {
260260 t .Error ("should match raw.githubusercontent.com" )
261261 }
262262 if got := req2 .Header .Get ("Authorization" ); got != "Bearer ghp_test" {
@@ -289,7 +289,7 @@ func TestBuildFromConfig_MissingEnvVarSkipped(t *testing.T) {
289289 URL : & url.URL {Host : "api.example.com" },
290290 Header : make (http.Header ),
291291 }
292- if store .InjectCredentials (req ) {
292+ if matched , _ := store .InjectCredentials (req ); matched {
293293 t .Error ("should not match when env var is unset" )
294294 }
295295}
@@ -324,7 +324,7 @@ func TestBuildFromConfig_MultipleEntries(t *testing.T) {
324324 URL : & url.URL {Host : "api.a.com" },
325325 Header : make (http.Header ),
326326 }
327- if ! store .InjectCredentials (req1 ) {
327+ if matched , injected := store .InjectCredentials (req1 ); ! matched || ! injected {
328328 t .Error ("should match api.a.com" )
329329 }
330330 if got := req1 .Header .Get ("Authorization" ); got != "Bearer key-a" {
@@ -336,7 +336,7 @@ func TestBuildFromConfig_MultipleEntries(t *testing.T) {
336336 URL : & url.URL {Host : "api.b.com" },
337337 Header : make (http.Header ),
338338 }
339- if ! store .InjectCredentials (req2 ) {
339+ if matched , injected := store .InjectCredentials (req2 ); ! matched || ! injected {
340340 t .Error ("should match api.b.com" )
341341 }
342342 if got := req2 .Header .Get ("Authorization" ); got != "Bearer key-b" {
@@ -372,7 +372,7 @@ func TestBuildFromConfig_GCloudFromJSON(t *testing.T) {
372372 URL : & url.URL {Host : "storage.googleapis.com" },
373373 Header : make (http.Header ),
374374 }
375- if ! store .InjectCredentials (req ) {
375+ if matched , _ := store .InjectCredentials (req ); ! matched {
376376 t .Error ("should match storage.googleapis.com with gcloud injector from JSON" )
377377 }
378378}
@@ -403,7 +403,7 @@ func TestBuildFromConfig_GCloudJSONPreferredOverFile(t *testing.T) {
403403 URL : & url.URL {Host : "storage.googleapis.com" },
404404 Header : make (http.Header ),
405405 }
406- if ! store .InjectCredentials (req ) {
406+ if matched , _ := store .InjectCredentials (req ); ! matched {
407407 t .Error ("should match storage.googleapis.com with gcloud injector from JSON" )
408408 }
409409}
@@ -473,7 +473,7 @@ func TestBuildFromConfig_ExactAndSuffixDomains(t *testing.T) {
473473 URL : & url.URL {Host : "exact.com" },
474474 Header : make (http.Header ),
475475 }
476- if ! store .InjectCredentials (req1 ) {
476+ if matched , injected := store .InjectCredentials (req1 ); ! matched || ! injected {
477477 t .Error ("should match exact.com" )
478478 }
479479
@@ -482,7 +482,7 @@ func TestBuildFromConfig_ExactAndSuffixDomains(t *testing.T) {
482482 URL : & url.URL {Host : "sub.suffix.com" },
483483 Header : make (http.Header ),
484484 }
485- if ! store .InjectCredentials (req2 ) {
485+ if matched , injected := store .InjectCredentials (req2 ); ! matched || ! injected {
486486 t .Error ("should match sub.suffix.com" )
487487 }
488488
@@ -491,7 +491,7 @@ func TestBuildFromConfig_ExactAndSuffixDomains(t *testing.T) {
491491 URL : & url.URL {Host : "other.com" },
492492 Header : make (http.Header ),
493493 }
494- if store .InjectCredentials (req3 ) {
494+ if matched , _ := store .InjectCredentials (req3 ); matched {
495495 t .Error ("should not match other.com" )
496496 }
497497}
0 commit comments