File tree Expand file tree Collapse file tree 3 files changed +26
-12
lines changed
Expand file tree Collapse file tree 3 files changed +26
-12
lines changed Original file line number Diff line number Diff line change 1+ module . exports = {
2+ arrowParens : 'avoid' ,
3+ tabWidth : 2 ,
4+ printWidth : 80 ,
5+ vueIndentScriptAndStyle : false ,
6+ quoteProps : 'consistent' ,
7+ semi : false ,
8+ singleQuote : true ,
9+ trailingComma : 'all' ,
10+ }
Original file line number Diff line number Diff line change @@ -14,13 +14,12 @@ class PreprClient {
1414 this . _token = token
1515 this . _baseUrl = baseUrl
1616 this . _timeout = timeout
17+ this . _abTestingValue = null
18+ this . _hasAbTesting = false
1719
1820 userId && this . _hashUserId ( userId )
1921 }
2022
21- _abTestingValue = null
22- _hasAbTesting = false
23-
2423 _hashUserId ( userId ) {
2524 const hashValue = murmurhash . v3 ( userId , 1 )
2625 const ratio = hashValue / Math . pow ( 2 , 32 )
@@ -96,20 +95,25 @@ class PreprClient {
9695
9796 const requestString = `${ this . _baseUrl } ${ this . _path } ?${ hasQueryString } `
9897
99- const abTestingHeaders = this . _hasAbTesting && {
100- 'Prepr-ABTesting' : this . _userId ,
98+ const headers = {
99+ Authorization : `Bearer ${ this . _token } ` ,
100+ }
101+
102+ Object . assign ( headers , options . headers )
103+
104+ if ( this . _hasAbTesting ) {
105+ Object . assign ( headers , {
106+ 'Prepr-ABTesting' : this . _userId ,
107+ } )
101108 }
102109
103110 const requestOptions = {
104- ...options ,
105111 signal : controller . signal ,
106- headers : {
107- ...options . headers ,
108- ...abTestingHeaders ,
109- Authorization : `Bearer ${ this . _token } ` ,
110- } ,
112+ headers,
111113 }
112114
115+ Object . assign ( requestOptions , options )
116+
113117 try {
114118 const response = await fetch ( requestString , requestOptions )
115119
Original file line number Diff line number Diff line change 11{
22 "name" : " @preprio/nodejs-sdk" ,
3- "version" : " 1.0.0 " ,
3+ "version" : " 1.0.1 " ,
44 "description" : " Prepr Node.js SDK" ,
55 "main" : " lib/index.js" ,
66 "directories" : {
You can’t perform that action at this time.
0 commit comments