reachable-url 1.6.7 → 1.6.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +4 -12
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -12,13 +12,12 @@ const mergeResponse = (responseOrigin = {}, responseDestination = {}) => ({
12
12
  ...responseDestination
13
13
  })
14
14
 
15
- const createFetcher = method => async (url, opts = {}) => {
15
+ const reachableUrl = async (url, opts = {}) => {
16
16
  const req = got(url, {
17
- retry: 0,
18
17
  ...opts,
18
+ retry: 0,
19
19
  decompress: false,
20
- responseType: 'buffer',
21
- method
20
+ responseType: 'buffer'
22
21
  })
23
22
 
24
23
  const redirectStatusCodes = []
@@ -48,15 +47,8 @@ const createFetcher = method => async (url, opts = {}) => {
48
47
  }
49
48
  }
50
49
 
51
- const createRequest = fetch => (url, opts) => fetch(url, opts)
52
-
53
- const fromGET = createRequest(createFetcher('get'))
54
-
55
50
  const isReachable = ({ statusCode }) => statusCode >= 200 && statusCode < 400
56
51
 
57
- module.exports = async (url, opts = {}) => {
58
- const { href: encodedUrl } = new URL(url)
59
- return fromGET(encodedUrl, opts)
60
- }
52
+ module.exports = async (url, opts) => reachableUrl(new URL(url).href, opts)
61
53
 
62
54
  module.exports.isReachable = isReachable
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "reachable-url",
3
3
  "description": "Given an url resolve it as fast as possible",
4
4
  "homepage": "https://nicedoc.io/Kikobeats/reachable-url",
5
- "version": "1.6.7",
5
+ "version": "1.6.8",
6
6
  "main": "index.js",
7
7
  "author": {
8
8
  "email": "josefrancisco.verdu@gmail.com",