-
Notifications
You must be signed in to change notification settings - Fork 762
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
Adding type to native markup for Prebid mobile #1081
Conversation
@SyntaxNode Thanks for feedback. I pushed an update |
exchange/bidder.go
Outdated
if err != nil { | ||
errs = append(errs, err) | ||
} | ||
bidResponse.Bids[i].Bid.AdM = string(markup) |
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.
If there were errors in the marshalling, do we still want to we still want to try overwriting the AdM with whatever json.Marshal()
managed to spit out?
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.
Good point. markup
very well may be nil
, of which string(markup)
would succeed and result in an empty 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.
Agreed. Updated
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.
Looks like no need to have PBM to pass in anything to request types?
@anwzhang Correct. If |
errs = append(errs, err) | ||
} | ||
var nativePayload nativeRequests.Request | ||
if err := json.Unmarshal(json.RawMessage((*nativeImp).Request), &nativePayload); err != nil { |
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.
We have a potential panic here. If getNativeImpByImpID()
fails to find the imp, then nativeImp
is nil. Trying to access nil.Request
will then panic, as you cannot dereference a nil
. You should probably abort above if nativeImp
is nil
. I don't think we need to abort here on Unmarshal
errors as the worst that should happen is we fail asset lookups and don't do anything.
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.
Done
"impid": "my-imp-id", | ||
"price": 10, | ||
"adid": "1234", | ||
"adm": "{\"assets\":[{\"id\":1,\"img\":{\"type\":3,\"url\":\"http://vcdn.adnxs.com/p/creative-image/f8/7f/0f/13/f87f0f13-230c-4f05-8087-db9216e393de.jpg\",\"w\":989,\"h\":742,\"ext\":{\"appnexus\":{\"prevent_crop\":0}}}},{\"title\":{\"text\":\"This is a Prebid Native Creative\"}},{\"id\":2,\"data\":{\"type\":1,\"value\":\"Prebid.org\"}},{\"id\":3,\"data\":{\"type\":2,\"value\":\"This is a Prebid Native Creative. There are many like it, but this one is mine.\"}}],\"link\":{\"url\":\"http://some-url.com\"},\"imptrackers\":[\"http://someimptracker.com\"],\"jstracker\":\"some-js-tracker\"}", |
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.
In the mock response, don't you want the adapter to return native markup without types being set, so you can verify the code does actually set the types?
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 misunderstood the exchange_test.go Now I moved my test to bidder_test.go
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.
See my inline comments
@hhhjort Pushed an update. Addressed all your feedback |
This PR implements #1041