requestBids with empty adUnitCodes requests all slots
Type of issue
Bug
Description
When I selectively want to request for some slots, using adUnitCodes property, I expect no request when this array is empty, but all previously registered slots are requested.
pbjs.requestBids({
timeout: 800,
adUnitCodes: [],
bidsBackHandler: myRefreshAction
})
When, instead of an empty array, an array with no valid ids is passed, no requests are made.
Not sure why you want no request to be made, but I can see why you'd think it as more consistent that way. Open for discussion.
Certainly is not a big problem to avoid this, but I thought that can lead to errors when using inadvertently, the same way I did.
I'm curious if someone might find this as a "feature" instead of a bug so that they wouldn't have to define what adUnitCodes are on the page
It works today similar to how DFP googletag.pubads().refresh() works, in that if you don't pass an array of codes all ad units on page will be refreshed, so as such this is working as designed.
yeah agree with @protonate. I just documented this to be more clear in the API: https://github.com/prebid/prebid.github.io/commit/f351a6b53174d08e10ef56a8848b4ce1e407c071