diff --git a/adapters/inmobi/inmobi.go b/adapters/inmobi/inmobi.go
index eb69bdf3ec2..9ceac3ec01a 100644
--- a/adapters/inmobi/inmobi.go
+++ b/adapters/inmobi/inmobi.go
@@ -77,10 +77,7 @@ func (a *InMobiAdapter) MakeBids(internalRequest *openrtb2.BidRequest, externalR
for _, sb := range serverBidResponse.SeatBid {
for i := range sb.Bid {
- mediaType, err := getMediaTypeForImp(sb.Bid[i])
- if err != nil {
- return nil, []error{err}
- }
+ mediaType := getMediaTypeForImp(sb.Bid[i].ImpID, internalRequest.Imp)
bidResponse.Bids = append(bidResponse.Bids, &adapters.TypedBid{
Bid: &sb.Bid[i],
BidType: mediaType,
@@ -121,17 +118,18 @@ func preprocess(imp *openrtb2.Imp) error {
return nil
}
-func getMediaTypeForImp(bid openrtb2.Bid) (openrtb_ext.BidType, error) {
- switch bid.MType {
- case openrtb2.MarkupBanner:
- return openrtb_ext.BidTypeBanner, nil
- case openrtb2.MarkupVideo:
- return openrtb_ext.BidTypeVideo, nil
- case openrtb2.MarkupNative:
- return openrtb_ext.BidTypeNative, nil
- default:
- return "", &errortypes.BadServerResponse{
- Message: fmt.Sprintf("Unsupported mtype %d for bid %s", bid.MType, bid.ID),
+func getMediaTypeForImp(impId string, imps []openrtb2.Imp) openrtb_ext.BidType {
+ mediaType := openrtb_ext.BidTypeBanner
+ for _, imp := range imps {
+ if imp.ID == impId {
+ if imp.Video != nil {
+ mediaType = openrtb_ext.BidTypeVideo
+ }
+ if imp.Native != nil {
+ mediaType = openrtb_ext.BidTypeNative
+ }
+ break
}
}
+ return mediaType
}
diff --git a/adapters/inmobi/inmobitest/exemplary/simple-app-banner.json b/adapters/inmobi/inmobitest/exemplary/simple-app-banner.json
index 01ccd98596f..563c8b9103e 100644
--- a/adapters/inmobi/inmobitest/exemplary/simple-app-banner.json
+++ b/adapters/inmobi/inmobitest/exemplary/simple-app-banner.json
@@ -75,8 +75,7 @@
"price": 2.0,
"id": "1234",
"adm": "bannerhtml",
- "impid": "imp-id",
- "mtype": 1
+ "impid": "imp-id"
}
]
}
@@ -95,7 +94,6 @@
"adm": "bannerhtml",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 1,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/exemplary/simple-app-native.json b/adapters/inmobi/inmobitest/exemplary/simple-app-native.json
index 0e956b6e586..7b823c13e11 100644
--- a/adapters/inmobi/inmobitest/exemplary/simple-app-native.json
+++ b/adapters/inmobi/inmobitest/exemplary/simple-app-native.json
@@ -73,8 +73,7 @@
"price": 2.0,
"id": "1234",
"adm": "native-json",
- "impid": "imp-id",
- "mtype": 4
+ "impid": "imp-id"
}
]
}
@@ -93,7 +92,6 @@
"adm": "native-json",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 4,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/exemplary/simple-app-video.json b/adapters/inmobi/inmobitest/exemplary/simple-app-video.json
index 644b42d573a..69356fd4de7 100644
--- a/adapters/inmobi/inmobitest/exemplary/simple-app-video.json
+++ b/adapters/inmobi/inmobitest/exemplary/simple-app-video.json
@@ -77,8 +77,7 @@
"price": 2.0,
"id": "1234",
"adm": " ",
- "impid": "imp-id",
- "mtype": 2
+ "impid": "imp-id"
}
]
}
@@ -97,7 +96,6 @@
"adm": " ",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 2,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/exemplary/simple-web-banner.json b/adapters/inmobi/inmobitest/exemplary/simple-web-banner.json
index 3359906e436..0aac1b1571d 100644
--- a/adapters/inmobi/inmobitest/exemplary/simple-web-banner.json
+++ b/adapters/inmobi/inmobitest/exemplary/simple-web-banner.json
@@ -73,8 +73,7 @@
"price": 2.0,
"id": "1234",
"adm": "bannerhtml",
- "impid": "imp-id",
- "mtype": 1
+ "impid": "imp-id"
}
]
}
@@ -93,7 +92,6 @@
"adm": "bannerhtml",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 1,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/exemplary/simple-web-native.json b/adapters/inmobi/inmobitest/exemplary/simple-web-native.json
index 25313573ea8..2d5a2a8c07c 100644
--- a/adapters/inmobi/inmobitest/exemplary/simple-web-native.json
+++ b/adapters/inmobi/inmobitest/exemplary/simple-web-native.json
@@ -71,8 +71,7 @@
"price": 2.0,
"id": "1234",
"adm": "native-json",
- "impid": "imp-id",
- "mtype": 4
+ "impid": "imp-id"
}
]
}
@@ -91,7 +90,6 @@
"adm": "native-json",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 4,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/exemplary/simple-web-video.json b/adapters/inmobi/inmobitest/exemplary/simple-web-video.json
index 582f9044fc9..7ea5dd268ef 100644
--- a/adapters/inmobi/inmobitest/exemplary/simple-web-video.json
+++ b/adapters/inmobi/inmobitest/exemplary/simple-web-video.json
@@ -75,8 +75,7 @@
"price": 2.0,
"id": "1234",
"adm": " ",
- "impid": "imp-id",
- "mtype": 2
+ "impid": "imp-id"
}
]
}
@@ -95,7 +94,6 @@
"adm": " ",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 2,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/supplemental/banner-format-coersion.json b/adapters/inmobi/inmobitest/supplemental/banner-format-coersion.json
index ee6aae529ee..211348de3f3 100644
--- a/adapters/inmobi/inmobitest/supplemental/banner-format-coersion.json
+++ b/adapters/inmobi/inmobitest/supplemental/banner-format-coersion.json
@@ -81,8 +81,7 @@
"price": 2.0,
"id": "1234",
"adm": "bannerhtml",
- "impid": "imp-id",
- "mtype": 1
+ "impid": "imp-id"
}
]
}
@@ -101,7 +100,6 @@
"adm": "bannerhtml",
"crid": "123456789",
"nurl": "https://some.event.url/params",
- "mtype": 1,
"ext": {
"prebid": {
"meta": {
diff --git a/adapters/inmobi/inmobitest/supplemental/invalid-mtype.json b/adapters/inmobi/inmobitest/supplemental/invalid-mtype.json
deleted file mode 100644
index af2192836b0..00000000000
--- a/adapters/inmobi/inmobitest/supplemental/invalid-mtype.json
+++ /dev/null
@@ -1,97 +0,0 @@
-{
- "mockBidRequest": {
- "site": {
- "page": "https://www.inmobi.com"
- },
- "id": "req-id",
- "device": {
- "ip": "1.1.1.1",
- "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36"
- },
- "imp": [
- {
- "ext": {
- "bidder": {
- "plc": "1621323101291"
- }
- },
- "video": {
- "w": 640,
- "h": 360,
- "mimes": ["video/mp4"]
- },
- "id": "imp-id"
- }
- ]
- },
- "httpCalls": [{
- "expectedRequest": {
- "uri": "https://api.w.inmobi.com/showad/openrtb/bidder/prebid",
- "body": {
- "site": {
- "page": "https://www.inmobi.com"
- },
- "id": "req-id",
- "device": {
- "ip": "1.1.1.1",
- "ua": "Mozilla/5.0 (Linux; Android 8.0.0; SM-G960F Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.84 Mobile Safari/537.36"
- },
- "imp": [
- {
- "ext": {
- "bidder": {
- "plc": "1621323101291"
- }
- },
- "video": {
- "w": 640,
- "h": 360,
- "mimes": ["video/mp4"]
- },
- "id": "imp-id"
- }
- ]
- },
- "impIDs":["imp-id"]
- },
- "mockResponse": {
- "status": 200,
- "body": {
- "id": "req-id",
- "seatbid": [
- {
- "bid": [
- {
- "ext": {
- "prebid": {
- "meta": {
- "networkName": "inmobi"
- }
- }
- },
- "nurl": "https://some.event.url/params",
- "crid": "123456789",
- "adomain": [],
- "price": 2.0,
- "id": "1234",
- "adm": " ",
- "impid": "imp-id",
- "mtype": 0
- }
- ]
- }
- ]
- }
- }
- }],
-
- "expectedBidResponses":[],
- "expectedMakeBidsErrors":[
- {
- "value":"Unsupported mtype 0 for bid 1234",
- "comparison":"literal"
- }
- ]
-}
-
-