Skip to content

Commit

Permalink
Adding default case and returning error in getBidType().
Browse files Browse the repository at this point in the history
  • Loading branch information
wilder0601 committed Jan 22, 2024
1 parent 41dc731 commit 3f8f06a
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions adapters/adview/adview.go
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ func getMediaTypeForBid(bid openrtb2.Bid, reqImps []openrtb2.Imp) (openrtb_ext.B
var bidExt *adviewBidExt
err := json.Unmarshal(bid.Ext, &bidExt)
if err == nil {
return getBidType(bidExt), nil
return getBidType(bidExt)
} else {
return mediaType, err
}
Expand All @@ -198,7 +198,7 @@ func getMediaTypeForBid(bid openrtb2.Bid, reqImps []openrtb2.Imp) (openrtb_ext.B
}

// getBidType returns the bid type specified in the response bid.ext
func getBidType(bidExt *adviewBidExt) openrtb_ext.BidType {
func getBidType(bidExt *adviewBidExt) (openrtb_ext.BidType, error) {
// setting "banner" as the default bid type
bidType := openrtb_ext.BidTypeBanner
if bidExt != nil {
Expand All @@ -210,9 +210,8 @@ func getBidType(bidExt *adviewBidExt) openrtb_ext.BidType {
case 2:
bidType = openrtb_ext.BidTypeNative
default:
// default is banner
bidType = openrtb_ext.BidTypeBanner
return "", fmt.Errorf("invalid BidType: %d", bidExt.BidType)
}
}
return bidType
return bidType, nil
}

0 comments on commit 3f8f06a

Please sign in to comment.