Answer the question
In order to leave comments, you need to log in
`
Why is the https get request not being sent?
const address = '0xd2522633650ac225eb410d92eb15bf82847b0220';
const options = {
"method": "GET",
"hostname": "api.rarible.org",
"port": null,
"path": `/v0.1/items/byOwner/?owner=ETHEREUM:${address}`,
"headers": {
"Content-Type": "application/json",
}
};
const req = https.request(options, function(res) {
// @ts-ignore
if ((res && res.statusCode < 200) || (res && res?.statusCode >= 300)) {
return reject(new Error('statusCode=' + res.statusCode));
}
// cumulate data
var body = [];
res.on('data', function (chunk) {
body.push(chunk);
});
// resolve on end
res.on('end', function () {
const body1 = Buffer.concat(body)
try {
body = JSON.parse(body1.toString('Uint8Array'));
} catch (e) {
resolve(body1);
return
}
resolve(body1);
return
});
});
req.on('error', function (err) {
reject(err);
});
req.end();
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question