-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Add type conversion into PrebidServer to handle inconsistent types. #1195
Conversation
Types should match the types found in : https://github.com/prebid/prebid-server/tree/master/adapters |
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.
LGTM
src/adapters/prebidServer.js
Outdated
utils.logMessage(`Mismatched type for Prebid Server : ${bid.bidder} : ${key}. Required Type:${types[key]}`); | ||
bid.params[key] = tryConvertType(types[key], bid.params[key]); | ||
//don't send invalid values | ||
if(!bid.params[key]) { |
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.
Wouldn't this cause problems if 0 or empty strings were a valid value for some param?
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.
Empty string shouldn't be valid but 0 might. I'll update
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.
LGTM
src/adapters/prebidServer.js
Outdated
|
||
function tryConvertType(typeToConvert, value) { | ||
if(typeToConvert === 'string') { | ||
return Number.toString(value); |
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.
No one caught this huh :)
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.
Does "weren't we requiring 80% unit test coverage on all new code?" count? 👼
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.
It does apply. I'm writing unit tests now.
Ready for review again. |
…rebid#1195) * Add type conversion into prebxdserver to handle inconsistent types. * Only check for params that exist. * adding test * fix string conversion and add unit tests * fix for code review * add debug output * remove accidental commit * newline
* Added ad unit size to bid request * Fixed lint errors * Added ad unit size to bid request * Prebid 0.23.1 Release * Add trafficSourceCode + test (#1184) * pre release version bump * inclusion of popular Nordic ad sizes to default size list (#1168) inclusion of popularNordic ad sizes to default size list Removed redundant 104 size and added size 32 instead Fixed trailing comma * Add PubWise Analytics (#1151) * PubWise Analytics * Updates based on Feedback * add new rp_secure param to rubicon adapter (#1190) * Add type conversion into PrebidServer to handle inconsistent types. (#1195) * Add type conversion into prebxdserver to handle inconsistent types. * Only check for params that exist. * adding test * fix string conversion and add unit tests * fix for code review * add debug output * remove accidental commit * newline * Add dynamic bidfloor parameter to Smart Adserver Adapter (#1194) * Smart AdServer adapter Add Smart AdServer adapter with tests * fix not supported method Replace startsWith which is not supported in all browser version by lastIndexOf. * Issue with optional parameter Fix issue when no targeting is specified and remove "undefined" value passed in url * Add dynamic bidfloor option in the SmartAdServer prebid call. * Bug fix: bids served by secure creatives does not get pushed into _winningBids (#1192) * Upgrade linters to ESLint with stricter code style (#1111) * Upgraded to ESLint with stricter code style, for both sources and tests * Updated some dependencies and the yarn.lock file * Add Support for DigiTrust in Rubicon Adapter (#1201) * Add support for DigiTrust * Add rubicon tests covering digitrust failures * Remove whitespace in Rubicon adapter * HIRO Media: Remove batching mechanism and use AJAX instead of JSONP (#1133) * Remove batching mechanism and use AJAX instead of JSONP * Fix `undefined` value checks * Rename secureCreatives file and lint (#1203) * Rename secureCreatives file and lint * Updated package script for linting * Use 'gulp run-tests' in package script for testing * updated tag (#1212) * Common user-sync (#1144) * Changed “bidRequest” to “bid” for clarity
Type of change
Description of change
Handles types for different bidders properly.
Other information
@prebid/core for review.