From b7f4f125af843867a3a7e90b02d7a55067e52106 Mon Sep 17 00:00:00 2001 From: hhhjort <31041505+hhhjort@users.noreply.github.com> Date: Tue, 11 Sep 2018 14:23:50 -0400 Subject: [PATCH] Removes openrtb.RawJSON from latest Pubmatic PR (#675) --- adapters/pubmatic/params_test.go | 9 +++++---- adapters/pubmatic/pubmatic.go | 8 ++++---- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/adapters/pubmatic/params_test.go b/adapters/pubmatic/params_test.go index 9365a08c821..598a6de6ce1 100644 --- a/adapters/pubmatic/params_test.go +++ b/adapters/pubmatic/params_test.go @@ -1,9 +1,10 @@ package pubmatic import ( - "github.com/mxmCherry/openrtb" - "github.com/prebid/prebid-server/openrtb_ext" + "encoding/json" "testing" + + "github.com/prebid/prebid-server/openrtb_ext" ) // This file actually intends to test static/bidder-params/pubmatic.json @@ -18,7 +19,7 @@ func TestValidParams(t *testing.T) { } for _, validParam := range validParams { - if err := validator.Validate(openrtb_ext.BidderPubmatic, openrtb.RawJSON(validParam)); err != nil { + if err := validator.Validate(openrtb_ext.BidderPubmatic, json.RawMessage(validParam)); err != nil { t.Errorf("Schema rejected pubmatic params: %s \n Error: %s", validParam, err) } } @@ -32,7 +33,7 @@ func TestInvalidParams(t *testing.T) { } for _, invalidParam := range invalidParams { - if err := validator.Validate(openrtb_ext.BidderPubmatic, openrtb.RawJSON(invalidParam)); err == nil { + if err := validator.Validate(openrtb_ext.BidderPubmatic, json.RawMessage(invalidParam)); err == nil { t.Errorf("Schema allowed unexpected params: %s", invalidParam) } } diff --git a/adapters/pubmatic/pubmatic.go b/adapters/pubmatic/pubmatic.go index b7546f0077a..18808d8fee9 100644 --- a/adapters/pubmatic/pubmatic.go +++ b/adapters/pubmatic/pubmatic.go @@ -153,7 +153,7 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder if len(params.Keywords) != 0 { kvstr := prepareImpressionExt(params.Keywords) - pbReq.Imp[i].Ext = openrtb.RawJSON([]byte(kvstr)) + pbReq.Imp[i].Ext = json.RawMessage([]byte(kvstr)) } else { pbReq.Imp[i].Ext = nil } @@ -198,7 +198,7 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder if wrapExt != "" { rawExt := fmt.Sprintf("{\"wrapper\": %s}", wrapExt) - pbReq.Ext = openrtb.RawJSON(rawExt) + pbReq.Ext = json.RawMessage(rawExt) } reqJSON, err := json.Marshal(pbReq) @@ -319,7 +319,7 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters if wrapExt != "" { rawExt := fmt.Sprintf("{\"wrapper\": %s}", wrapExt) - request.Ext = openrtb.RawJSON(rawExt) + request.Ext = json.RawMessage(rawExt) } if request.Site != nil { @@ -439,7 +439,7 @@ func parseImpressionObject(imp *openrtb.Imp, wrapExt *string, pubID *string) err if pubmaticExt.Keywords != nil && len(pubmaticExt.Keywords) != 0 { kvstr := makeKeywordStr(pubmaticExt.Keywords) - imp.Ext = openrtb.RawJSON([]byte(kvstr)) + imp.Ext = json.RawMessage([]byte(kvstr)) } else { imp.Ext = nil }