Skip to content

Commit

Permalink
Merge pull request prebid#9 from PubMatic-OpenWrap/revert-cookie-addi…
Browse files Browse the repository at this point in the history
…tion

revert sending cookies to pubmatic adapter
  • Loading branch information
PubMatic-OpenWrap authored Apr 9, 2019
2 parents fcfd020 + b049331 commit 31e5005
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 34 deletions.
32 changes: 0 additions & 32 deletions adapters/pubmatic/pubmatic.go
Original file line number Diff line number Diff line change
Expand Up @@ -300,34 +300,6 @@ func (a *PubmaticAdapter) Call(ctx context.Context, req *pbs.PBSRequest, bidder
return bids, nil
}

func getCookiesFromRequest(request *openrtb.BidRequest) []string {
var reqExt openrtb_ext.ExtRequest
err := json.Unmarshal(request.Ext, &reqExt)
if err != nil {
logf("[PUBMATIC] Error while unmarshalling request.ext: %v.", string(request.Ext))
return nil
}

if reqExt.RequestParams["Cookie"] == nil {
return nil
}

cbyte, err := json.Marshal(reqExt.RequestParams["Cookie"])
if err != nil {
logf("[PUBMATIC] Error retrieving cookies from request.ext.requestparams: %v.", reqExt.RequestParams)
return nil
}

var cookies []string
err = json.Unmarshal(cbyte, &cookies)
if err != nil {
logf("[PUBMATIC] Error retrieving cookies from request.ext.requestparams: %v.", reqExt.RequestParams)
return nil
}

return cookies
}

func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters.RequestData, []error) {
errs := make([]error, 0, len(request.Imp))

Expand All @@ -345,7 +317,6 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters
}
}

cookies := getCookiesFromRequest(request)
if wrapExt != "" {
rawExt := fmt.Sprintf("{\"wrapper\": %s}", wrapExt)
request.Ext = openrtb.RawJSON(rawExt)
Expand Down Expand Up @@ -393,9 +364,6 @@ func (a *PubmaticAdapter) MakeRequests(request *openrtb.BidRequest) ([]*adapters
headers := http.Header{}
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
for _, line := range cookies {
headers.Add("Cookie", line)
}

return []*adapters.RequestData{{
Method: "POST",
Expand Down
2 changes: 0 additions & 2 deletions openrtb_ext/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@ import (
)

// ExtRequest defines the contract for bidrequest.ext
// ExtRequest.RequestParams should only be used for data common to the request. It should not be used for bidder specific data
type ExtRequest struct {
Prebid ExtRequestPrebid `json:"prebid"`
RequestParams map[string]interface{} `json:"requestparams,omitempty"`
}

// ExtRequestPrebid defines the contract for bidrequest.ext.prebid
Expand Down

0 comments on commit 31e5005

Please sign in to comment.