@unito/integration-sdk 1.0.16 → 1.0.18
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/dist/src/index.cjs
CHANGED
|
@@ -1283,7 +1283,9 @@ class Provider {
|
|
|
1283
1283
|
// (Provider's response Content-Type might be more specific, e.g. application/json;charset=utf-8)
|
|
1284
1284
|
// Default to application/json if no Content-Type header is provided
|
|
1285
1285
|
if (responseContentType && !responseContentType.includes('application/json')) {
|
|
1286
|
-
|
|
1286
|
+
const textResult = await response.text();
|
|
1287
|
+
throw this.handleError(500, `Unsupported content-type, expected 'application/json' but got '${responseContentType}'.
|
|
1288
|
+
Original response (${response.status}): ${textResult}`);
|
|
1287
1289
|
}
|
|
1288
1290
|
try {
|
|
1289
1291
|
body = response.body ? await response.json() : undefined;
|
|
@@ -277,7 +277,9 @@ export class Provider {
|
|
|
277
277
|
// (Provider's response Content-Type might be more specific, e.g. application/json;charset=utf-8)
|
|
278
278
|
// Default to application/json if no Content-Type header is provided
|
|
279
279
|
if (responseContentType && !responseContentType.includes('application/json')) {
|
|
280
|
-
|
|
280
|
+
const textResult = await response.text();
|
|
281
|
+
throw this.handleError(500, `Unsupported content-type, expected 'application/json' but got '${responseContentType}'.
|
|
282
|
+
Original response (${response.status}): ${textResult}`);
|
|
281
283
|
}
|
|
282
284
|
try {
|
|
283
285
|
body = response.body ? await response.json() : undefined;
|
|
@@ -401,7 +401,7 @@ describe('Provider', () => {
|
|
|
401
401
|
error = e;
|
|
402
402
|
}
|
|
403
403
|
assert.ok(error instanceof HttpErrors.HttpError);
|
|
404
|
-
assert.equal(error.
|
|
404
|
+
assert.equal(error.status, 500);
|
|
405
405
|
});
|
|
406
406
|
it('throws on status 400', async (context) => {
|
|
407
407
|
const response = new Response('response body', {
|
package/package.json
CHANGED
|
@@ -372,9 +372,11 @@ export class Provider {
|
|
|
372
372
|
// (Provider's response Content-Type might be more specific, e.g. application/json;charset=utf-8)
|
|
373
373
|
// Default to application/json if no Content-Type header is provided
|
|
374
374
|
if (responseContentType && !responseContentType.includes('application/json')) {
|
|
375
|
+
const textResult = await response.text();
|
|
375
376
|
throw this.handleError(
|
|
376
377
|
500,
|
|
377
|
-
`Unsupported content-type
|
|
378
|
+
`Unsupported content-type, expected 'application/json' but got '${responseContentType}'.
|
|
379
|
+
Original response (${response.status}): ${textResult}`,
|
|
378
380
|
);
|
|
379
381
|
}
|
|
380
382
|
|
|
@@ -479,7 +479,7 @@ describe('Provider', () => {
|
|
|
479
479
|
}
|
|
480
480
|
|
|
481
481
|
assert.ok(error instanceof HttpErrors.HttpError);
|
|
482
|
-
assert.equal(error.
|
|
482
|
+
assert.equal(error.status, 500);
|
|
483
483
|
});
|
|
484
484
|
|
|
485
485
|
it('throws on status 400', async context => {
|