Skip to content

Commit 0ebf4aa

Browse files
abueideclaude
andcommitted
fix: add httpConfig to Config type and fix TypeScript errors
- Add httpConfig?: HttpConfig to Config type - Remove unused checkResponseForErrors import - Pass correct flattened config to classifyError() - TypeScript now compiles cleanly Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
1 parent 6f8bf67 commit 0ebf4aa

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

packages/core/src/plugins/SegmentDestination.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import { DestinationMetadataEnrichment } from './DestinationMetadataEnrichment';
1313
import { QueueFlushingPlugin } from './QueueFlushingPlugin';
1414
import { defaultApiHost, defaultConfig } from '../constants';
1515
import {
16-
checkResponseForErrors,
1716
translateHTTPError,
1817
classifyError,
1918
parseRetryAfter,
@@ -97,7 +96,12 @@ export class SegmentDestination extends DestinationPlugin {
9796
: undefined;
9897

9998
// Classify error
100-
const classification = classifyError(res.status, config.httpConfig);
99+
const classification = classifyError(res.status, {
100+
default4xxBehavior: config.httpConfig?.backoffConfig?.default4xxBehavior,
101+
default5xxBehavior: config.httpConfig?.backoffConfig?.default5xxBehavior,
102+
statusCodeOverrides: config.httpConfig?.backoffConfig?.statusCodeOverrides,
103+
rateLimitEnabled: config.httpConfig?.rateLimitConfig?.enabled,
104+
});
101105

102106
if (classification.errorType === 'rate_limit') {
103107
return {

packages/core/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,7 @@ export type Config = {
151151
cdnProxy?: string;
152152
useSegmentEndpoints?: boolean; // Use if you want to use Segment endpoints
153153
errorHandler?: (error: SegmentError) => void;
154+
httpConfig?: HttpConfig;
154155
};
155156

156157
export type ClientMethods = {

0 commit comments

Comments
 (0)