Skip to content

Commit

Permalink
fix: decoupling networkHandler and specific strategy
Browse files Browse the repository at this point in the history
  • Loading branch information
shrouti1507 committed Nov 20, 2024
1 parent 25a5ced commit c87c5ce
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
5 changes: 1 addition & 4 deletions src/v1/destinations/iterable/networkHandler.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
const { prepareProxyRequest, proxyRequest } = require('../../../adapters/network');
const { processAxiosResponse } = require('../../../adapters/utils/networkUtils');
const { BULK_ENDPOINTS } = require('../../../v0/destinations/iterable/config');
const {
checkIfEventIsAbortableAndExtractErrorMessage,
} = require('../../../v0/destinations/iterable/util');
const { CommonStrategy } = require('./commonStrategy');
const { TrackIdentifyStrategy } = require('./trackIdentifyStrategy');

const getResponseStrategy = (endpoint) => {
if (BULK_ENDPOINTS.some((path) => endpoint.includes(path))) {
return new TrackIdentifyStrategy(checkIfEventIsAbortableAndExtractErrorMessage);
return new TrackIdentifyStrategy();
}
return new CommonStrategy();

Check warning on line 11 in src/v1/destinations/iterable/networkHandler.js

View check run for this annotation

Codecov / codecov/patch

src/v1/destinations/iterable/networkHandler.js#L11

Added line #L11 was not covered by tests
};
Expand Down
7 changes: 5 additions & 2 deletions src/v1/destinations/iterable/trackIdentifyStrategy.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
const { ResponseStrategy } = require('./responseStrategy');
const {
checkIfEventIsAbortableAndExtractErrorMessage,
} = require('../../../v0/destinations/iterable/util');

class TrackIdentifyStrategy extends ResponseStrategy {
constructor(filterFn) {
constructor() {
super();
this.filterFn = filterFn;
this.filterFn = checkIfEventIsAbortableAndExtractErrorMessage;
}

handleSuccess(responseParams) {
Expand Down

0 comments on commit c87c5ce

Please sign in to comment.