Skip to content

Commit

Permalink
imds: Change imds/synacormedia adapter hostname to be static and add …
Browse files Browse the repository at this point in the history
…adapter version to endpoint URL. (#2793)

Co-authored-by: Timothy M. Ace <tace@imds.tv>
  • Loading branch information
ecammit and ecammit committed May 29, 2023
1 parent b644cdb commit 0526a99
Show file tree
Hide file tree
Showing 13 changed files with 17 additions and 14 deletions.
5 changes: 4 additions & 1 deletion adapters/imds/imds.go
Expand Up @@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"net/http"
"net/url"
"text/template"

"github.com/prebid/openrtb/v19/openrtb2"
Expand All @@ -14,6 +15,8 @@ import (
"github.com/prebid/prebid-server/openrtb_ext"
)

const adapterVersion string = "pbs-go/1.0.0"

type adapter struct {
EndpointTemplate *template.Template
}
Expand Down Expand Up @@ -127,7 +130,7 @@ func (a *adapter) makeRequest(request *openrtb2.BidRequest) (*adapters.RequestDa

// Builds enpoint url based on adapter-specific pub settings from imp.ext
func (adapter *adapter) buildEndpointURL(params *openrtb_ext.ExtImpImds) (string, error) {
return macros.ResolveMacros(adapter.EndpointTemplate, macros.EndpointTemplateParams{Host: params.SeatId})
return macros.ResolveMacros(adapter.EndpointTemplate, macros.EndpointTemplateParams{AccountID: url.QueryEscape(params.SeatId), SourceId: url.QueryEscape(adapterVersion)})
}

func getExtImpObj(imp *openrtb2.Imp) (*openrtb_ext.ExtImpImds, error) {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imds_test.go
Expand Up @@ -11,7 +11,7 @@ import (

func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderImds, config.Adapter{
Endpoint: "http://{{.Host}}.technoratimedia.com/openrtb/bids/{{.Host}}"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})
Endpoint: "http://pbs.technoratimedia.com/openrtb/bids/{{.AccountID}}?src={{.SourceId}}&adapter=imds"}, config.Server{ExternalUrl: "http://hosturl.com", GvlID: 1, DataCenter: "2"})

if buildErr != nil {
t.Fatalf("Builder returned unexpected error %v", buildErr)
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/exemplary/simple-banner.json
Expand Up @@ -25,7 +25,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/exemplary/simple-video.json
Expand Up @@ -31,7 +31,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "1",
"site": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/audio_response.json
Expand Up @@ -20,7 +20,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/bad_response.json
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/native_response.json
Expand Up @@ -20,7 +20,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/one_bad_ext.json
Expand Up @@ -42,7 +42,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/status_204.json
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/status_400.json
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion adapters/imds/imdstest/supplemental/status_500.json
Expand Up @@ -29,7 +29,7 @@
"httpCalls": [
{
"expectedRequest": {
"uri": "http://prebid.technoratimedia.com/openrtb/bids/prebid",
"uri": "http://pbs.technoratimedia.com/openrtb/bids/prebid?src=pbs-go%2F1.0.0&adapter=imds",
"body": {
"id": "test-request-id",
"ext": {
Expand Down
2 changes: 1 addition & 1 deletion static/bidder-info/imds.yaml
@@ -1,4 +1,4 @@
endpoint: "http://{{.Host}}.technoratimedia.com/openrtb/bids/{{.Host}}"
endpoint: "https://pbs.technoratimedia.com/openrtb/bids/{{.AccountID}}?src={{.SourceId}}&adapter=imds"
maintainer:
email: "eng-demand@imds.tv"
capabilities:
Expand Down
4 changes: 2 additions & 2 deletions static/bidder-info/synacormedia.yaml
@@ -1,5 +1,5 @@
# DEPRECATED: Use imds bidder instead
endpoint: "http://{{.Host}}.technoratimedia.com/openrtb/bids/{{.Host}}"
endpoint: "https://pbs.technoratimedia.com/openrtb/bids/{{.AccountID}}?src={{.SourceId}}&adapter=synacormedia"
maintainer:
email: "eng-demand@imds.tv"
capabilities:
Expand All @@ -12,4 +12,4 @@ capabilities:
- banner
- video
userSync:
key: "imds"
key: "imds"

0 comments on commit 0526a99

Please sign in to comment.