-
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
Frank fpd issue #3455
Frank fpd issue #3455
Conversation
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.
existing code LGTM, with the exception of the note below
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.
Consider adding logic to wrap string or number in array.
if (Array.isArray(params.visitor[key])) {
slotData.visitor[key] = params.visitor[key]
} else if ((typeof params.visitor[key] === 'string' && params.visitor[key] !== '') || typeof params.visitor[key] === 'number') {
slotData.visitor[key] = [params.visitor[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.
I like @idettman's suggestion about putting scalars in arrays.
let value = params.visitor[key];
if (Array.isArray(value)) {
slotData.visitor[key] = value;
} else if ((typeof value === 'string' && value !== '') || typeof value === 'number') {
slotData.visitor[key] = [value];
}
expect(slot.visitor).to.have.property('ucat').that.equals('new'); | ||
expect(slot.visitor).to.have.property('lastsearch').that.equals('iphone'); | ||
expect(slot.visitor).to.have.property('ucat').that.deep.equals(['new']); | ||
expect(slot.visitor).to.have.property('lastsearch').that.deep.equals(['iphone']); |
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.
Now instead of sending a bad request it is sending the array wrapped data which will be accepted by Frank.
|
||
if (params.keywords && Array.isArray(params.keywords)) { | ||
slotData.keywords = params.keywords; | ||
} | ||
|
||
if (params.visitor && typeof params.visitor === 'object') { | ||
slotData.visitor = params.visitor; | ||
} |
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.
combined both visitor and inventory into one block since they have same requirements and necessary checks.
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
* Changing to requestId in order to align with prebid cores mapping of bidId to responseId * Rubi Bid Adapter: Do not pass non-array FPD to Frank Video * Updating based on review + tests
Type of change
Description of change
Noticed that we do not check the validity of visitor and inventory fpd values before forwarding through.
If each key in the inventory or visitor object is not an array of values, FRANK will 400.
This change verifies they are arrays before attaching them.