@jsforce/jsforce-node 3.9.2 → 3.9.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/VERSION.d.ts +1 -1
- package/lib/VERSION.js +1 -1
- package/lib/http-api.js +9 -3
- package/package.json +1 -1
package/lib/VERSION.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
declare const _default: "3.9.
|
|
1
|
+
declare const _default: "3.9.3";
|
|
2
2
|
export default _default;
|
package/lib/VERSION.js
CHANGED
package/lib/http-api.js
CHANGED
|
@@ -157,7 +157,10 @@ class HttpApi extends events_1.EventEmitter {
|
|
|
157
157
|
}
|
|
158
158
|
const bodySize = (0, get_body_size_1.getBodySize)(request.body, headers);
|
|
159
159
|
const cannotHaveBody = ['GET', 'HEAD', 'OPTIONS'].includes(request.method);
|
|
160
|
-
|
|
160
|
+
// Don't set content-length in browsers as it's not allowed
|
|
161
|
+
const isBrowser = 'window' in globalThis || 'self' in globalThis;
|
|
162
|
+
if (!isBrowser &&
|
|
163
|
+
!cannotHaveBody &&
|
|
161
164
|
!!request.body &&
|
|
162
165
|
!('transfer-encoding' in headers) &&
|
|
163
166
|
!('content-length' in headers) &&
|
|
@@ -225,7 +228,8 @@ class HttpApi extends events_1.EventEmitter {
|
|
|
225
228
|
isSessionExpired(response) {
|
|
226
229
|
// TODO:
|
|
227
230
|
// The connected app msg only applies to Agent API requests, we should move this to a separate SFAP/Agent API class later.
|
|
228
|
-
return response.statusCode === 401 &&
|
|
231
|
+
return (response.statusCode === 401 &&
|
|
232
|
+
!response.body.includes('Connected app is not attached to Agent'));
|
|
229
233
|
}
|
|
230
234
|
/**
|
|
231
235
|
* Detect error response
|
|
@@ -289,7 +293,9 @@ class HttpApi extends events_1.EventEmitter {
|
|
|
289
293
|
Check that the org exists and can be reached.
|
|
290
294
|
See \`error.data\` for the full html response.`, error.errorCode, error.message);
|
|
291
295
|
}
|
|
292
|
-
return error instanceof HttpApiError
|
|
296
|
+
return error instanceof HttpApiError
|
|
297
|
+
? error
|
|
298
|
+
: new HttpApiError(error.message, error.errorCode, error);
|
|
293
299
|
}
|
|
294
300
|
}
|
|
295
301
|
exports.HttpApi = HttpApi;
|