Skip to content

Commit

Permalink
fix: add user-agent header in api calls
Browse files Browse the repository at this point in the history
  • Loading branch information
Sai Sankeerth committed Jul 15, 2024
1 parent 9ea8a35 commit 53710f9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions src/cdk/v2/destinations/intercom/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ const getHeaders = (destination, apiVersion) => ({
Authorization: `Bearer ${destination.Config.apiKey}`,
Accept: JSON_MIME_TYPE,
'Intercom-Version': apiVersion === 'v1' ? '1.4' : '2.10',
'User-Agent': process.env.INTERCOM_USER_AGENT_HEADER ?? 'RudderStack',
});

/**
Expand Down
8 changes: 7 additions & 1 deletion src/v0/destinations/intercom/networkHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,18 @@ const destResponseHandler = (responseParams) => {
};
};

const prepareIntercomProxyRequest = (request) => {
const preparedRequest = prepareProxyRequest(request);
preparedRequest.headers['User-Agent'] = process.env.INTERCOM_USER_AGENT_HEADER ?? 'RudderStack';
return preparedRequest;
};

// eslint-disable-next-line @typescript-eslint/naming-convention
class networkHandler {
constructor() {
this.responseHandler = destResponseHandler;
this.proxy = proxyRequest;
this.prepareProxy = prepareProxyRequest;
this.prepareProxy = prepareIntercomProxyRequest;
this.processAxiosResponse = processAxiosResponse;
}
}
Expand Down

0 comments on commit 53710f9

Please sign in to comment.