Skip to content

Commit cdbda12

Browse files
committed
Fix JSON tag, added benchmark
1 parent f25701a commit cdbda12

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

bench_test.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,22 @@ func BenchmarkBidRequest_Unmarshal(b *testing.B) {
2121
}
2222
}
2323
}
24+
25+
func BenchmarkBidRequest_Marshal(b *testing.B) {
26+
data, err := ioutil.ReadFile(filepath.Join("testdata", "breq.video.json"))
27+
if err != nil {
28+
b.Fatal(err.Error())
29+
}
30+
31+
var req *BidRequest
32+
if err := json.Unmarshal(data, &req); err != nil {
33+
b.Fatal(err.Error())
34+
}
35+
36+
b.ResetTimer()
37+
for i := 0; i < b.N; i++ {
38+
if _, err := json.Marshal(req); err != nil {
39+
b.Fatal(err.Error())
40+
}
41+
}
42+
}

content.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ type Content struct {
1515
Season string `json:"season,omitempty"` // Content season.
1616
Producer *Producer `json:"producer,omitempty"` // The producer.
1717
URL string `json:"url,omitempty"` // URL of the content, for buy-side contextualization or review.
18-
Cat []string `json:"url,omitempty"` // Array of IAB content categories that describe the content.
18+
Cat []string `json:"cat,omitempty"` // Array of IAB content categories that describe the content.
1919
VideoQuality int `json:"videoquality,omitempty"` // Video quality per IAB's classification.
2020
Context int `json:"context,omitempty"` // Type of content (game, video, text, etc.).
2121
ContentRating string `json:"contentrating,omitempty"` // Content rating (e.g., MPAA).

0 commit comments

Comments
 (0)