Skip to content
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

Removed some redundant methods #1320

Merged
merged 37 commits into from
Jun 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
98e1c1c
TELARIA adapter. First Pass
Feb 21, 2020
9329c4a
Merge branch 'master' of https://github.com/prebid/prebid-server
Feb 21, 2020
eced74d
Some refactoring
Feb 21, 2020
bd482af
added the json files
Feb 24, 2020
44d6bdc
fixed some tests and added the bidder info
Feb 24, 2020
854269c
fixed some tests and added the bidder info
Feb 26, 2020
e76bbde
added default user sync ur;
Feb 26, 2020
9ad2d55
Merge branch 'master' of https://github.com/prebid/prebid-server
Feb 26, 2020
e56007c
- Handling gzipped responses from our server
Feb 26, 2020
b4e3db4
- more refactoring.
Feb 26, 2020
0427507
added the proper user sync default URL
Feb 27, 2020
3d8ae59
changed the urls from dev to prod
Feb 27, 2020
ebe24ca
Merge branch 'master' of https://github.com/prebid/prebid-server
Feb 27, 2020
9320f4a
changed up the required fields. Now AdCode in the Imp.Ext isn't requi…
Mar 3, 2020
84c68f2
Merge branch 'master' of https://github.com/prebid/prebid-server
Mar 5, 2020
59e7858
change in the return type after decompressing
Mar 7, 2020
b4bfc8d
some refactoring
Mar 10, 2020
ea5bce9
Merge branch 'master' of https://github.com/prebid/prebid-server
Mar 10, 2020
ec251d7
change in our config url
Mar 18, 2020
21dcb1f
Merge branch 'master' of https://github.com/prebid/prebid-server
Mar 18, 2020
f7b3cce
using pbs.yml to switch between our production and test URLs
Mar 20, 2020
31a69b4
setting default endpoint
Mar 21, 2020
a22719d
- fixed the issue that was preventing telaria test cases to run.
Mar 25, 2020
c8cd84f
Merge branch 'master' of https://github.com/prebid/prebid-server
Mar 25, 2020
965715f
- Modifications as per the changes requested by the maintainers.
Mar 27, 2020
65e5ff8
Merge branch 'master' of https://github.com/prebid/prebid-server
Mar 27, 2020
6df25cc
Moved the seat code to imp.ext
Apr 6, 2020
8e77271
Moved the seat code to imp.ext
Apr 6, 2020
f06705d
Merge https://github.com/prebid/prebid-server
Apr 6, 2020
22b8a2d
Added 'Telaria: ' prefix for error messages
Apr 6, 2020
53a1833
- Fixes for race conditions. Was modifying the original request objec…
Apr 7, 2020
6f7cb77
cosmetic changes.
Apr 9, 2020
63eeb39
added params_test.go
Apr 9, 2020
852eda4
Merge branch 'master' of https://github.com/prebid/prebid-server
Apr 14, 2020
a3da4d3
Merge branch 'master' of https://github.com/prebid/prebid-server
May 28, 2020
08db57b
Removed some redundant methods.
May 28, 2020
5717296
Removed a comment
May 29, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 1 addition & 36 deletions adapters/telaria/telaria.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package telaria

import (
"bytes"
"compress/gzip"
"encoding/json"
"fmt"
"github.com/mxmCherry/openrtb"
Expand Down Expand Up @@ -79,7 +77,6 @@ func GetHeaders(request *openrtb.BidRequest) *http.Header {
headers.Add("Content-Type", "application/json;charset=utf-8")
headers.Add("Accept", "application/json")
headers.Add("X-Openrtb-Version", "2.5")
headers.Add("Accept-Encoding", "gzip")

if request.Device != nil {
if len(request.Device.UA) > 0 {
Expand Down Expand Up @@ -233,34 +230,6 @@ func (a *TelariaAdapter) MakeRequests(requestIn *openrtb.BidRequest, reqInfo *ad
}}, nil
}

// response isn't automatically decompressed. This method unzips the response if Content-Encoding is gzip
func GetResponseBody(response *adapters.ResponseData) ([]byte, error) {

if "gzip" == response.Headers.Get("Content-Encoding") {
body := bytes.NewBuffer(response.Body)
r, readerErr := gzip.NewReader(body)
if readerErr != nil {
return nil, &errortypes.BadServerResponse{
Message: fmt.Sprintf("Error while trying to unzip data [ %d ]", response.StatusCode),
}
}
var resB bytes.Buffer
var err error
_, err = resB.ReadFrom(r)
if err != nil {
return nil, &errortypes.BadServerResponse{
Message: fmt.Sprintf("Error while trying to unzip data [ %d ]", response.StatusCode),
}
}

response.Headers.Del("Content-Encoding")

return resB.Bytes(), nil
} else {
return response.Body, nil
}
}

func (a *TelariaAdapter) CheckResponseStatusCodes(response *adapters.ResponseData) error {
if response.StatusCode == http.StatusNoContent {
return &errortypes.BadInput{Message: "Telaria: Invalid Bid Request received by the server"}
Expand Down Expand Up @@ -294,11 +263,7 @@ func (a *TelariaAdapter) MakeBids(internalRequest *openrtb.BidRequest, externalR
return nil, []error{httpStatusError}
}

responseBody, err := GetResponseBody(response)

if err != nil {
return nil, []error{err}
}
responseBody := response.Body

var bidResp openrtb.BidResponse
if err := json.Unmarshal(responseBody, &bidResp); err != nil {
Expand Down
1 change: 0 additions & 1 deletion adapters/telaria/telariatest/exemplary/video-app.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"Content-Type": ["application/json;charset=utf-8"],
"Accept": ["application/json"],
"X-Openrtb-Version": ["2.5"],
"Accept-Encoding": ["gzip"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Accept-Language": ["en"],
Expand Down
1 change: 0 additions & 1 deletion adapters/telaria/telariatest/exemplary/video-web.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"Content-Type": ["application/json;charset=utf-8"],
"Accept": ["application/json"],
"X-Openrtb-Version": ["2.5"],
"Accept-Encoding": ["gzip"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Accept-Language": ["en"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@
"Content-Type": ["application/json;charset=utf-8"],
"Accept": ["application/json"],
"X-Openrtb-Version": ["2.5"],
"Accept-Encoding": ["gzip"],
"User-Agent": ["test-user-agent"],
"X-Forwarded-For": ["123.123.123.123"],
"Accept-Language": ["en"],
Expand Down