-
Notifications
You must be signed in to change notification settings - Fork 846
New Adapter: iqiyi #4605
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
New Adapter: iqiyi #4605
Conversation
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
remove go.mod and go.sum files add go.mod go.sum format json file
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
|
@Heihuang your tests are failing due to formatting issues. Please run |
Code coverage summaryNote:
iqiyiRefer here for heat map coverage report |
|
I send a request via postman: And I got the response with this error: |
| endpoint *template.Template | ||
| } | ||
|
|
||
| func pickCurrency(req *openrtb2.BidRequest, resp *openrtb2.BidResponse) string { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't say that this would be a critic comment, perhaps a better name for the function would be selectCurrency or something like that
| return nil, errs | ||
| } | ||
|
|
||
| reqJson, err := json.Marshal(request) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The same, it is not critical issue, but the better name would be reqJSON
|
|
||
| var iqiyiExt openrtb_ext.ExtImpIqiyi | ||
| if err := jsonutil.Unmarshal(bidderExt.Bidder, &iqiyiExt); err != nil { | ||
| errs = append(errs, &errortypes.BadInput{Message: "bad Iqiyi bidder ext"}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Both unmarshal operations on lines 63 and 69 use the same error message. Differentiate them
| imp := &request.Imp[i] | ||
| if imp.Banner != nil { | ||
| b := *imp.Banner | ||
| if (b.W == nil || b.H == nil || *b.W == 0 || *b.H == 0) && len(b.Format) > 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
*b.W == 0 and *b.H == 0 are hardcoded values. Extract to named constants:
const (
defaultBannerFormatIndex = 0
)
| } | ||
| } | ||
| if imp.BidFloorCur == "" && imp.BidFloor > 0 { | ||
| imp.BidFloorCur = "USD" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Comment not only for this line.
For blockforas a whole:
At this point you are modifying the original Imp, I think it would be better to change the code to the following:
for i := range request.Imp {
// Copy the entire Imp object
impCopy := request.Imp[i]
if impCopy.Banner != nil {
bannerCopy := *impCopy.Banner
if (bannerCopy.W == nil || bannerCopy.H == nil || *bannerCopy.W == 0 || *bannerCopy.H == 0) && len(bannerCopy.Format) > 0 {
first := bannerCopy.Format[0]
bannerCopy.W = &first.W
bannerCopy.H = &first.H
}
impCopy.Banner = &bannerCopy
}
if impCopy.BidFloorCur == "" && impCopy.BidFloor > 0 {
impCopy.BidFloorCur = "USD"
}
requestCopy.Imp[i] = impCopy
}
"USD"is hardcoded value. Extract to named constants:
const (
defaultBidFloorCurrency = "USD"
)
|
|
||
| func (a *adapter) MakeRequests(request *openrtb2.BidRequest, reqInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) { | ||
| var errs []error | ||
| if len(request.Imp) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Prebid Server's core exchange logic already validates that requests have at least one valid impression before calling adapter's MakeRequests.
The exchange will never pass a request with zero impressions to an adapter
Adding iqiyi prebid server adapter