Socket
Socket
Sign inDemoInstall

@zeit/fetch-cached-dns

Package Overview
Dependencies
Maintainers
14
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@zeit/fetch-cached-dns - npm Package Compare versions

Comparing version 1.0.2 to 1.0.3

5

History.md
1.0.3 / 2017-11-16
==================
* fix `headers` as a regular Object
1.0.2 / 2017-11-16

@@ -3,0 +8,0 @@ ==================

4

index.js

@@ -20,3 +20,3 @@ const { isIP } = require('net')

if (!opts) opts = {}
if (!opts.headers) opts.headers = new Headers()
opts.headers = new Headers(opts.headers)
if (!opts.headers.has('Host')) {

@@ -32,3 +32,3 @@ opts.headers.set('Host', parsed.host)

const redirectOpts = Object.assign({}, opts)
if (!redirectOpts.headers) redirectOpts.headers = new Headers()
redirectOpts.headers = new Headers(opts.headers)

@@ -35,0 +35,0 @@ // per fetch spec, for POST request with 301/302 response, or any request with 303 response, use GET when following redirect

{
"name": "@zeit/fetch-cached-dns",
"version": "1.0.2",
"version": "1.0.3",
"description": "A decorator on top of `fetch` that caches the DNS query of the `hostname` of the passed URL",

@@ -5,0 +5,0 @@ "scripts": {

@@ -50,1 +50,18 @@ /* eslint-env jest*/

})
test('works with `headers` as an Object', async () => {
const server = createServer((req, res) => {
res.end(req.headers['x-zeit'])
})
await listen(server)
const { port } = server.address()
const res = await cachedDNSFetch(`http://localtest.me:${port}`, {
headers: {
'X-Zeit': 'geist'
}
})
expect(await res.text()).toBe('geist')
server.close()
})
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