Skip to content

Commit

Permalink
Removes openrtb.RawJSON from latest Pubmatic PR (#675)
Browse files Browse the repository at this point in the history
  • Loading branch information
hhhjort authored Sep 11, 2018
1 parent de93b43 commit b7f4f12
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
9 changes: 5 additions & 4 deletions adapters/pubmatic/params_test.go
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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)
}
}
Expand All @@ -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)
}
}
Expand Down
8 changes: 4 additions & 4 deletions adapters/pubmatic/pubmatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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
}
Expand Down

0 comments on commit b7f4f12

Please sign in to comment.