Skip to content

Commit

Permalink
feat: add user agent to dsc requests
Browse files Browse the repository at this point in the history
  • Loading branch information
ntatoud committed May 15, 2024
1 parent aff86d2 commit fb17e2f
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
19 changes: 16 additions & 3 deletions packages/server/esp/dsc/dscProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,11 @@ class DscProvider {

async connectApiCall() {
return axios.get(`${config.dscUrl}`, {
headers: { apiKey: this.apiKey, 'Content-Type': 'application/json' },
headers: {
apiKey: this.apiKey,
'Content-Type': 'application/json',
'User-Agent': config.dscUserAgent,
},
});
}

Expand Down Expand Up @@ -49,6 +53,7 @@ class DscProvider {
headers: {
apiKey: this.apiKey,
'Content-Type': 'application/json',
'User-Agent': config.dscUserAgent,
},
});
}
Expand All @@ -57,7 +62,11 @@ class DscProvider {
const url = `${config.dscUrl}/withTypeCampagne`;
try {
return await axios.post(url, restData, {
headers: { apiKey: this.apiKey, 'Content-Type': 'application/json' },
headers: {
apiKey: this.apiKey,
'Content-Type': 'application/json',
'User-Agent': config.dscUserAgent,
},
params: { typeCampagne },
});
} catch (error) {
Expand All @@ -69,7 +78,11 @@ class DscProvider {
const url = `${config.dscUrl}/withTypeCampagne/${campaignMailId}`;
try {
return await axios.put(url, restData, {
headers: { apiKey: this.apiKey, 'Content-Type': 'application/json' },
headers: {
apiKey: this.apiKey,
'Content-Type': 'application/json',
'User-Agent': config.dscUserAgent,
},
params: { typeCampagne },
});
} catch (error) {
Expand Down
1 change: 1 addition & 0 deletions packages/server/node.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ const config = rc('lepatron', {
},
proxyUrl: process.env.QUOTAGUARDSTATIC_URL,
dscUrl: process.env.DSC_ESP_URL,
dscUserAgent: process.env.DSC_USER_AGENT,
NODE_ENV: process.env.NODE_ENV,
});

Expand Down

0 comments on commit fb17e2f

Please sign in to comment.