Skip to content

Commit

Permalink
make event endpoint case insensitive (#3199)
Browse files Browse the repository at this point in the history
  • Loading branch information
gargcreation1992 authored Oct 16, 2023
1 parent dff9b3b commit 987e640
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
8 changes: 7 additions & 1 deletion endpoints/events/event.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"errors"
"fmt"
"github.com/prebid/prebid-server/openrtb_ext"
"net/http"
"net/url"
"strconv"
Expand Down Expand Up @@ -188,7 +189,12 @@ func ParseEventRequest(r *http.Request) (*analytics.EventRequest, []error) {
}

// Bidder
event.Bidder = r.URL.Query().Get(BidderParameter)
bidderName := r.URL.Query().Get(BidderParameter)
if normalisedBidderName, ok := openrtb_ext.NormalizeBidderName(bidderName); ok {
bidderName = normalisedBidderName.String()
}

event.Bidder = bidderName

return event, errs
}
Expand Down
13 changes: 13 additions & 0 deletions endpoints/events/event_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,19 @@ func TestShouldParseEventCorrectly(t *testing.T) {
Analytics: analytics.Enabled,
},
},
"case insensitive bidder name": {
req: httptest.NewRequest("GET", "/event?t=win&b=bidId&f=b&ts=1000&x=1&a=accountId&bidder=RubiCon&int=intType", strings.NewReader("")),
expected: &analytics.EventRequest{
Type: analytics.Win,
BidID: "bidId",
Timestamp: 1000,
Bidder: "rubicon",
AccountID: "",
Format: analytics.Blank,
Analytics: analytics.Enabled,
Integration: "intType",
},
},
}

for name, test := range tests {
Expand Down

0 comments on commit 987e640

Please sign in to comment.