You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
19 lines
447 B
19 lines
447 B
var ipLocation = require('ip-location')
|
|
|
|
ipLocation.httpGet = function (url, callback) {
|
|
var xhr = new XMLHttpRequest()
|
|
xhr.open('get', url, true)
|
|
xhr.responseType = 'text'
|
|
xhr.onreadystatechange = function () {
|
|
if (xhr.readyState === 4) {
|
|
if (xhr.status === 200) {
|
|
callback(null, { body: xhr.responseText })
|
|
} else {
|
|
callback(xhr.responseText)
|
|
}
|
|
}
|
|
}
|
|
xhr.send()
|
|
}
|
|
|
|
module.exports = ipLocation
|