@@ -1338,7 +1338,9 @@ func TestExtractBuilderIDFromOIDC(t *testing.T) {
13381338 token := fmt .Sprintf ("%s.%s.%s" , header , payload , signature )
13391339
13401340 w .Header ().Set ("Content-Type" , "application/json" )
1341- json .NewEncoder (w ).Encode (map [string ]string {"value" : token })
1341+ if err := json .NewEncoder (w ).Encode (map [string ]string {"value" : token }); err != nil {
1342+ t .Errorf ("Failed to encode response: %v" , err )
1343+ }
13421344 }))
13431345 },
13441346 githubCtx : & GitHubContext {
@@ -1362,7 +1364,9 @@ func TestExtractBuilderIDFromOIDC(t *testing.T) {
13621364 token := fmt .Sprintf ("%s.%s.%s" , header , payload , signature )
13631365
13641366 w .Header ().Set ("Content-Type" , "application/json" )
1365- json .NewEncoder (w ).Encode (map [string ]string {"value" : token })
1367+ if err := json .NewEncoder (w ).Encode (map [string ]string {"value" : token }); err != nil {
1368+ t .Errorf ("Failed to encode response: %v" , err )
1369+ }
13661370 }))
13671371 },
13681372 githubCtx : & GitHubContext {
@@ -1379,7 +1383,9 @@ func TestExtractBuilderIDFromOIDC(t *testing.T) {
13791383 return httptest .NewServer (http .HandlerFunc (func (w http.ResponseWriter , r * http.Request ) {
13801384 token := "header.payload"
13811385 w .Header ().Set ("Content-Type" , "application/json" )
1382- json .NewEncoder (w ).Encode (map [string ]string {"value" : token })
1386+ if err := json .NewEncoder (w ).Encode (map [string ]string {"value" : token }); err != nil {
1387+ t .Errorf ("Failed to encode response: %v" , err )
1388+ }
13831389 }))
13841390 },
13851391 githubCtx : & GitHubContext {
@@ -1399,7 +1405,9 @@ func TestExtractBuilderIDFromOIDC(t *testing.T) {
13991405 token := fmt .Sprintf ("%s.%s.%s" , header , payload , signature )
14001406
14011407 w .Header ().Set ("Content-Type" , "application/json" )
1402- json .NewEncoder (w ).Encode (map [string ]string {"value" : token })
1408+ if err := json .NewEncoder (w ).Encode (map [string ]string {"value" : token }); err != nil {
1409+ t .Errorf ("Failed to encode response: %v" , err )
1410+ }
14031411 }))
14041412 },
14051413 githubCtx : & GitHubContext {
@@ -1557,7 +1565,9 @@ func TestBuilderIDMatchesCertificateIdentity(t *testing.T) {
15571565 token := fmt .Sprintf ("%s.%s.%s" , header , payload , signature )
15581566
15591567 w .Header ().Set ("Content-Type" , "application/json" )
1560- json .NewEncoder (w ).Encode (map [string ]string {"value" : token })
1568+ if err := json .NewEncoder (w ).Encode (map [string ]string {"value" : token }); err != nil {
1569+ t .Errorf ("Failed to encode response: %v" , err )
1570+ }
15611571 }))
15621572 defer server .Close ()
15631573
0 commit comments