New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

axios-cached-dns-resolve

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

axios-cached-dns-resolve - npm Package Compare versions

Comparing version 0.2.0 to 0.3.0

3

__tests__/test.js

@@ -80,4 +80,6 @@ import { serial as test } from 'ava'

const lastUsedTs = axiosCachingDns.config.cache.get('microsoft.com').lastUsedTs
t.is(1, axiosCachingDns.config.cache.get('microsoft.com').nextIdx)
await axiosClient.get('https://microsoft.com')
t.is(2, axiosCachingDns.config.cache.get('microsoft.com').nextIdx)

@@ -88,2 +90,3 @@ t.truthy(lastUsedTs < axiosCachingDns.config.cache.get('microsoft.com').lastUsedTs)

await axiosClient.get('https://microsoft.com')
t.is(3, axiosCachingDns.config.cache.get('microsoft.com').nextIdx)

@@ -90,0 +93,0 @@ t.falsy(lastUsedTs === axiosCachingDns.config.cache.get('microsoft.com').lastUsedTs)

16

dist/axios-cached-dns-resolve.js

@@ -30,2 +30,6 @@ 'use strict';

var _cloneDeep = require('lodash/cloneDeep');
var _cloneDeep2 = _interopRequireDefault(_cloneDeep);
var _lruCache = require('lru-cache');

@@ -122,4 +126,4 @@

reqConfig.headers = config.headers || {};
reqConfig.headers.Host = url.hostname; // set hostname in header
var reqConfigCopy = (0, _cloneDeep2.default)(reqConfig); // do not modify original which has hostname instead of IP address
reqConfigCopy.headers.Host = url.hostname; // set hostname in header

@@ -129,9 +133,9 @@ url.hostname = await getAddress(url.hostname);

if (reqConfig.baseURL) {
reqConfig.baseURL = _url2.default.format(url);
if (reqConfigCopy.baseURL) {
reqConfigCopy.baseURL = _url2.default.format(url);
} else {
reqConfig.url = _url2.default.format(url);
reqConfigCopy.url = _url2.default.format(url);
}
return reqConfig;
return reqConfigCopy;
});

@@ -138,0 +142,0 @@ }

@@ -5,2 +5,3 @@ import dns from 'dns'

import stringify from 'json-stringify-safe'
import cloneDeep from 'lodash/cloneDeep'
import LRUCache from 'lru-cache'

@@ -88,4 +89,4 @@ import { init as initLogger } from './logging'

reqConfig.headers = config.headers || {}
reqConfig.headers.Host = url.hostname // set hostname in header
const reqConfigCopy = cloneDeep(reqConfig) // do not modify original which has hostname instead of IP address
reqConfigCopy.headers.Host = url.hostname // set hostname in header

@@ -95,9 +96,9 @@ url.hostname = await getAddress(url.hostname)

if (reqConfig.baseURL) {
reqConfig.baseURL = URL.format(url)
if (reqConfigCopy.baseURL) {
reqConfigCopy.baseURL = URL.format(url)
} else {
reqConfig.url = URL.format(url)
reqConfigCopy.url = URL.format(url)
}
return reqConfig
return reqConfigCopy
})

@@ -104,0 +105,0 @@ }

{
"name": "axios-cached-dns-resolve",
"version": "0.2.0",
"version": "0.3.0",
"description": "Caches dns resolutions made with async dns.resolve instead of default sync dns.lookup, refreshes in background",

@@ -52,2 +52,3 @@ "main": "index.js",

"babel-polyfill": "^6.26.0",
"lodash": "^4.17.11",
"lru-cache": "^5.1.1",

@@ -54,0 +55,0 @@ "pino": "^5.12.2",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc