Я пытался подключиться к HTTP API (не https), и все библиотеки, которые я тестирую (https, request, ax ios, SuperAgent и Got), работают только с https. Я получаю ошибку:
TypeError [ERR_INVALID_PROTOCOL]: Protocol "http:" not supported. Expected "https:"
at new ClientRequest (_http_client.js:152:11)
at request (https.js:314:10)
(...)
Код:
const https = require('https');
https
.get('http://ip-api.com/json/24.48.0.1', resp => {
let data = '';
// A chunk of data has been recieved.
resp.on('data', chunk => {
data += chunk;
});
// The whole response has been received. Print out the result.
resp.on('end', () => {
console.log(JSON.parse(data).explanation);
});
})
.on('error', err => {
console.log('Error: ' + err.message);
});
К кому я могу подключиться по http?
Спасибо