stellarscrape
Advanced tools
Comparing version 1.0.5 to 1.0.51
@@ -34,2 +34,3 @@ "use strict"; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
const url = `${apiurl}/product`; | ||
@@ -46,2 +47,9 @@ console.log(url); | ||
}); | ||
if (!response.ok) { | ||
throw Error(`HTTP error! status: ${response.status}`); | ||
} | ||
// check if the response is json | ||
if (!((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json'))) { | ||
throw Error('Response is not JSON'); | ||
} | ||
const data = yield response.json(); | ||
@@ -65,2 +73,3 @@ return data; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
// Set default values inside the function if not provided | ||
@@ -79,2 +88,9 @@ amount = amount !== null && amount !== void 0 ? amount : 10; | ||
}); | ||
if (!response.ok) { | ||
throw Error(`HTTP error! status: ${response.status}`); | ||
} | ||
// check if the response is json | ||
if (!((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json'))) { | ||
throw Error('Response is not JSON'); | ||
} | ||
const data = yield response.json(); | ||
@@ -98,2 +114,3 @@ return data; | ||
return __awaiter(this, void 0, void 0, function* () { | ||
var _a; | ||
if (asinArray.length > 100) { | ||
@@ -115,2 +132,10 @@ throw Error("To much asin, the limit is 100 asin per requests"); | ||
}); | ||
// check if the response is ok | ||
if (!response.ok) { | ||
throw Error(`HTTP error! status: ${response.status}`); | ||
} | ||
// check if the response is json | ||
if (!((_a = response.headers.get('content-type')) === null || _a === void 0 ? void 0 : _a.includes('application/json'))) { | ||
throw Error('Response is not JSON'); | ||
} | ||
const data = yield response.json(); | ||
@@ -117,0 +142,0 @@ return data; |
{ | ||
"name": "stellarscrape", | ||
"version": "1.0.5", | ||
"version": "1.0.51", | ||
"description": "The apiWrapper for the StellarScrape API", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
34359
589