You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In order to configure timeout for API calls, call `client.withTimeouts(config)` to create a new client with timeout settings, leaving the original client unmodified.
188
+
189
+
`timeoutMs` is in milliseconds and is applied to each request attempt.
190
+
191
+
```js
192
+
constnewClient=client.withTimeouts({
193
+
timeoutMs:30000,
194
+
});
195
+
```
196
+
197
+
If `timeoutMs` is not provided or is less than or equal to `0`, no SDK timeout is applied.
198
+
184
199
# Use Proxy for API calls
185
200
186
201
In order to use a proxy for API calls, calling the `client.withProxy(proxyConfig)` method creates a new client, leaving the original client unmodified, with the username and password being optional.
- The SDK applies timeout only when `timeoutMs` is provided and greater than `0`.
195
+
- To disable SDK timeout handling, set `timeoutMs` to `0` (or a negative value), or omit `timeoutMs`.
196
+
- On timeout, the request is aborted and treated as a network error (`Connection timeout after <timeoutMs>ms`); if retries are exhausted, the SDK throws `BoxSdkError`.
197
+
- Timeout failures are handled as request exceptions, then retry behavior is controlled by the configured retry strategy.
198
+
- Timeout applies to a single HTTP request attempt to the Box API (not the total time across all retries).
* Generate a fresh network session by duplicating the existing configuration and network parameters, while also including additional headers to be attached to every API call.
@@ -122,6 +128,7 @@ export class NetworkSession {
122
128
networkClient: this.networkClient,
123
129
retryStrategy: this.retryStrategy,
124
130
dataSanitizer: this.dataSanitizer,
131
+
timeoutConfig: this.timeoutConfig,
125
132
});
126
133
}
127
134
/**
@@ -140,6 +147,7 @@ export class NetworkSession {
140
147
networkClient: this.networkClient,
141
148
retryStrategy: this.retryStrategy,
142
149
dataSanitizer: this.dataSanitizer,
150
+
timeoutConfig: this.timeoutConfig,
143
151
});
144
152
}
145
153
/**
@@ -158,6 +166,7 @@ export class NetworkSession {
158
166
networkClient: this.networkClient,
159
167
retryStrategy: this.retryStrategy,
160
168
dataSanitizer: this.dataSanitizer,
169
+
timeoutConfig: this.timeoutConfig,
161
170
});
162
171
}
163
172
/**
@@ -176,6 +185,7 @@ export class NetworkSession {
176
185
networkClient: this.networkClient,
177
186
retryStrategy: this.retryStrategy,
178
187
dataSanitizer: this.dataSanitizer,
188
+
timeoutConfig: this.timeoutConfig,
179
189
});
180
190
}
181
191
/**
@@ -194,6 +204,7 @@ export class NetworkSession {
194
204
networkClient: networkClient,
195
205
retryStrategy: this.retryStrategy,
196
206
dataSanitizer: this.dataSanitizer,
207
+
timeoutConfig: this.timeoutConfig,
197
208
});
198
209
}
199
210
/**
@@ -212,6 +223,7 @@ export class NetworkSession {
212
223
networkClient: this.networkClient,
213
224
retryStrategy: retryStrategy,
214
225
dataSanitizer: this.dataSanitizer,
226
+
timeoutConfig: this.timeoutConfig,
215
227
});
216
228
}
217
229
/**
@@ -231,6 +243,26 @@ export class NetworkSession {
231
243
networkClient: this.networkClient,
232
244
retryStrategy: this.retryStrategy,
233
245
dataSanitizer: dataSanitizer,
246
+
timeoutConfig: this.timeoutConfig,
247
+
});
248
+
}
249
+
/**
250
+
* Generate a fresh network session by duplicating the existing configuration and network parameters, while also applying timeout config
0 commit comments