@@ -11,7 +11,6 @@ import (
1111
1212 "github.com/google/go-cmp/cmp"
1313 pb "github.com/google/osv.dev/go/cmd/gitter/pb/repository"
14- "google.golang.org/protobuf/encoding/protojson"
1514 "google.golang.org/protobuf/proto"
1615)
1716
@@ -278,9 +277,8 @@ func TestCacheHandler(t *testing.T) {
278277 for _ , tt := range tests {
279278 t .Run (tt .name , func (t * testing.T ) {
280279 reqProto := & pb.CacheRequest {Url : tt .url }
281- body , _ := protojson .Marshal (reqProto )
280+ body , _ := proto .Marshal (reqProto )
282281 req , err := http .NewRequest (http .MethodPost , "/cache" , bytes .NewBuffer (body ))
283- req .Header .Set ("Content-Type" , "application/json" )
284282 if err != nil {
285283 t .Fatal (err )
286284 }
@@ -367,9 +365,8 @@ func TestAffectedCommitsHandler(t *testing.T) {
367365 Events : events ,
368366 }
369367
370- body , _ := protojson .Marshal (reqProto )
368+ body , _ := proto .Marshal (reqProto )
371369 req , err := http .NewRequest (http .MethodPost , "/affected-commits" , bytes .NewBuffer (body ))
372- req .Header .Set ("Content-Type" , "application/json" )
373370 if err != nil {
374371 t .Fatal (err )
375372 }
@@ -386,14 +383,8 @@ func TestAffectedCommitsHandler(t *testing.T) {
386383 }
387384
388385 respBody := & pb.AffectedCommitsResponse {}
389- if rr .Header ().Get ("Content-Type" ) == "application/json" {
390- if err := protojson .Unmarshal (rr .Body .Bytes (), respBody ); err != nil {
391- t .Fatalf ("Failed to unmarshal JSON response: %v" , err )
392- }
393- } else {
394- if err := proto .Unmarshal (rr .Body .Bytes (), respBody ); err != nil {
395- t .Fatalf ("Failed to unmarshal proto response: %v" , err )
396- }
386+ if err := proto .Unmarshal (rr .Body .Bytes (), respBody ); err != nil {
387+ t .Fatalf ("Failed to unmarshal proto response: %v" , err )
397388 }
398389
399390 var gotHashes []string
@@ -451,7 +442,6 @@ func TestTagsHandler(t *testing.T) {
451442 for _ , tt := range tests {
452443 t .Run (tt .name , func (t * testing.T ) {
453444 req , err := http .NewRequest (http .MethodGet , "/tags?url=" + tt .url , nil )
454- req .Header .Set ("Content-Type" , "application/json" )
455445 if err != nil {
456446 t .Fatal (err )
457447 }
@@ -465,8 +455,8 @@ func TestTagsHandler(t *testing.T) {
465455
466456 if tt .expectedTags != nil {
467457 respBody := & pb.TagsResponse {}
468- if err := protojson .Unmarshal (rr .Body .Bytes (), respBody ); err != nil {
469- t .Fatalf ("Failed to unmarshal JSON response: %v" , err )
458+ if err := proto .Unmarshal (rr .Body .Bytes (), respBody ); err != nil {
459+ t .Fatalf ("Failed to unmarshal proto response: %v" , err )
470460 }
471461
472462 gotTags := make (map [string ]string )
0 commit comments