Skip to content

Adds an interceptor to axios to allow for queries to be run against a custom DNS.

Notifications You must be signed in to change notification settings

alienzhou/axios-with-dns

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axios-with-dns

Allows you to query axios with a different/custom DNS server.

Usage

Allows you to pass in a "dnsServer" object into the axios config. It will run URLs against that dns server. You do this by passing an axios instance into the export function. This obviously requires Axios as a peer dependency. This is done by adding an interceptor to Axios.

This works in node and the browser

const withDNS = require('axios-with-dns');
const axios = require('axios');

withDNS(axios);

(async () => {
  console.log(
    (await axios.get('https://www.google.com', { dnsServer: '8.8.8.8' })).config
      .url
  );
})();

Why?

I was working in a hybrid cloud on AWS and was annoyed by Route53's pricing model, so I created this package to allow for my application to run some queries against an internal DNS server.

Credits

This issue in the Axios repo

About

Adds an interceptor to axios to allow for queries to be run against a custom DNS.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%