Skip to content

Commit

Permalink
Merge pull request #795 from Badsender-com/feat/dsc-user-agent
Browse files Browse the repository at this point in the history
Feat: DSC API Request with User-Agent
  • Loading branch information
FlorianGille authored May 16, 2024
2 parents f11bd93 + fb17e2f commit 7fdb283
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 7fdb283

Please sign in to comment.