@@ -40,7 +40,7 @@ const bidRequests = [
40
40
const prebidRequests = [
41
41
{
42
42
method : 'GET' ,
43
- url : 'https://btlr.sharethrough.com' + ' /WYu2BXv1/v1',
43
+ url : 'https://btlr.sharethrough.com/WYu2BXv1/v1' ,
44
44
data : {
45
45
bidId : 'bidId' ,
46
46
placement_key : 'pKey'
@@ -52,7 +52,7 @@ const prebidRequests = [
52
52
} ,
53
53
{
54
54
method : 'GET' ,
55
- url : 'https://btlr.sharethrough.com' + ' /WYu2BXv1/v1',
55
+ url : 'https://btlr.sharethrough.com/WYu2BXv1/v1' ,
56
56
data : {
57
57
bidId : 'bidId' ,
58
58
placement_key : 'pKey'
@@ -64,7 +64,7 @@ const prebidRequests = [
64
64
} ,
65
65
{
66
66
method : 'GET' ,
67
- url : 'https://btlr.sharethrough.com' + ' /WYu2BXv1/v1',
67
+ url : 'https://btlr.sharethrough.com/WYu2BXv1/v1' ,
68
68
data : {
69
69
bidId : 'bidId' ,
70
70
placement_key : 'pKey'
@@ -77,7 +77,7 @@ const prebidRequests = [
77
77
} ,
78
78
{
79
79
method : 'GET' ,
80
- url : 'https://btlr.sharethrough.com' + ' /WYu2BXv1/v1',
80
+ url : 'https://btlr.sharethrough.com/WYu2BXv1/v1' ,
81
81
data : {
82
82
bidId : 'bidId' ,
83
83
placement_key : 'pKey'
@@ -89,7 +89,7 @@ const prebidRequests = [
89
89
} ,
90
90
{
91
91
method : 'GET' ,
92
- url : 'https://btlr.sharethrough.com' + ' /WYu2BXv1/v1',
92
+ url : 'https://btlr.sharethrough.com/WYu2BXv1/v1' ,
93
93
data : {
94
94
bidId : 'bidId' ,
95
95
placement_key : 'pKey'
@@ -120,9 +120,9 @@ const bidderResponse = {
120
120
header : { get : ( header ) => header }
121
121
} ;
122
122
123
- const setUserAgent = ( str ) => {
123
+ const setUserAgent = ( uaString ) => {
124
124
window . navigator [ '__defineGetter__' ] ( 'userAgent' , function ( ) {
125
- return str ;
125
+ return uaString ;
126
126
} ) ;
127
127
} ;
128
128
@@ -217,10 +217,8 @@ describe('sharethrough adapter spec', function () {
217
217
it ( 'should return an array of requests' , function ( ) {
218
218
const builtBidRequests = spec . buildRequests ( bidRequests ) ;
219
219
220
- expect ( builtBidRequests [ 0 ] . url ) . to . eq (
221
- 'https://btlr.sharethrough.com/WYu2BXv1/v1' ) ;
222
- expect ( builtBidRequests [ 1 ] . url ) . to . eq (
223
- 'https://btlr.sharethrough.com/WYu2BXv1/v1' ) ;
220
+ expect ( builtBidRequests [ 0 ] . url ) . to . eq ( 'https://btlr.sharethrough.com/WYu2BXv1/v1' ) ;
221
+ expect ( builtBidRequests [ 1 ] . url ) . to . eq ( 'https://btlr.sharethrough.com/WYu2BXv1/v1' ) ;
224
222
expect ( builtBidRequests [ 0 ] . method ) . to . eq ( 'GET' ) ;
225
223
} ) ;
226
224
@@ -250,6 +248,27 @@ describe('sharethrough adapter spec', function () {
250
248
expect ( builtBidRequests [ 0 ] . data . instant_play_capable ) . to . be . false ;
251
249
} ) ;
252
250
251
+ it ( 'should set the secure parameter to false when the protocol is http' , function ( ) {
252
+ const stub = sinon . stub ( sharethroughInternal , 'getProtocol' ) . returns ( 'http:' ) ;
253
+ const bidRequest = spec . buildRequests ( bidRequests , null ) [ 0 ] ;
254
+ expect ( bidRequest . data . secure ) . to . be . false ;
255
+ stub . restore ( )
256
+ } ) ;
257
+
258
+ it ( 'should set the secure parameter to true when the protocol is https' , function ( ) {
259
+ const stub = sinon . stub ( sharethroughInternal , 'getProtocol' ) . returns ( 'https:' ) ;
260
+ const bidRequest = spec . buildRequests ( bidRequests , null ) [ 0 ] ;
261
+ expect ( bidRequest . data . secure ) . to . be . true ;
262
+ stub . restore ( )
263
+ } ) ;
264
+
265
+ it ( 'should set the secure parameter to true when the protocol is neither http or https' , function ( ) {
266
+ const stub = sinon . stub ( sharethroughInternal , 'getProtocol' ) . returns ( 'about:' ) ;
267
+ const bidRequest = spec . buildRequests ( bidRequests , null ) [ 0 ] ;
268
+ expect ( bidRequest . data . secure ) . to . be . true ;
269
+ stub . restore ( )
270
+ } ) ;
271
+
253
272
it ( 'should add consent parameters if gdprConsent is present' , function ( ) {
254
273
const gdprConsent = { consentString : 'consent_string123' , gdprApplies : true } ;
255
274
const bidderRequest = { gdprConsent : gdprConsent } ;
0 commit comments