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.1.1 to 0.2.0

16

__tests__/test.js

@@ -1,2 +0,2 @@

import { test } from 'ava'
import { serial as test } from 'ava'
import delay from 'delay'

@@ -39,2 +39,16 @@ import dns from 'dns'

test.after.always(() => {
axiosCachingDns.config.cache.reset()
})
test('query google with baseURL and relative url', async t => {
axiosCachingDns.registerInterceptor(axios)
const { data } = await axios.get('/finance', {
baseURL: 'http://www.google.com',
//headers: { Authorization: `Basic ${basicauth}` },
})
t.truthy(data)
})
test('query google caches and after idle delay uncached', async t => {

@@ -41,0 +55,0 @@ const resp = await axiosClient.get('https://amazon.com')

@@ -112,3 +112,8 @@ 'use strict';

axios.interceptors.request.use(async function (reqConfig) {
var url = _url2.default.parse(reqConfig.url);
var url = void 0;
if (reqConfig.baseURL) {
url = _url2.default.parse(reqConfig.baseURL);
} else {
url = _url2.default.parse(reqConfig.url);
}

@@ -123,3 +128,7 @@ if (_net2.default.isIP(url.hostname)) return reqConfig; // skip

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

@@ -126,0 +135,0 @@ return reqConfig;

@@ -78,3 +78,8 @@ import dns from 'dns'

axios.interceptors.request.use(async (reqConfig) => {
const url = URL.parse(reqConfig.url)
let url
if (reqConfig.baseURL) {
url = URL.parse(reqConfig.baseURL)
} else {
url = URL.parse(reqConfig.url)
}

@@ -89,3 +94,7 @@ if (net.isIP(url.hostname)) return reqConfig // skip

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

@@ -92,0 +101,0 @@ return reqConfig

2

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

@@ -5,0 +5,0 @@ "main": "index.js",

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