We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8c65ef6 commit a0848a0Copy full SHA for a0848a0
index.js
@@ -8,8 +8,8 @@ const statusCodes = {
8
};
9
10
module.exports = async url => {
11
- url = url.replace(/^(?:https?:)?\/\//, '');
12
- url = encodeURIComponent(url);
+ url = new URL(url);
+ url = encodeURIComponent(url.host);
13
14
const {body} = await got(`https://isitup.org/${url}.json`, {
15
json: true,
test.js
@@ -11,5 +11,5 @@ test('down', async t => {
});
test('invalid domain', async t => {
- await t.throwsAsync(isUp('unicorn'), 'Invalid domain');
+ await t.throwsAsync(isUp('unicorn'), 'Invalid URL: unicorn');
0 commit comments