Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simple-get

Package Overview
Dependencies
Maintainers
1
Versions
39
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simple-get - npm Package Compare versions

Comparing version 3.0.3 to 3.1.0

6

index.js

@@ -18,3 +18,3 @@ module.exports = simpleGet

if (opts.url) {
const { hostname, port, protocol, auth, path } = url.parse(opts.url)
const { hostname, port, protocol, auth, path } = url.parse(opts.url) // eslint-disable-line node/no-deprecated-api
delete opts.url

@@ -49,3 +49,3 @@ if (!hostname && !port && !protocol && !auth) opts.path = path // Relative redirect

const req = protocol.request(opts, res => {
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
if (opts.followRedirects !== false && res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
opts.url = res.headers.location // Follow 3xx redirects

@@ -98,5 +98,5 @@ delete opts.headers.host // Discard `host` header on redirect (see #32)

simpleGet[method] = (opts, cb) => {
if (typeof opts === 'string') opts = {url: opts}
if (typeof opts === 'string') opts = { url: opts }
return simpleGet(Object.assign({ method: method.toUpperCase() }, opts), cb)
}
})
{
"name": "simple-get",
"description": "Simplest way to make http get requests. Supports HTTPS, redirects, gzip/deflate, streams in < 100 lines.",
"version": "3.0.3",
"version": "3.1.0",
"author": {

@@ -17,3 +17,3 @@ "name": "Feross Aboukhadijeh",

"dependencies": {
"decompress-response": "^3.3.0",
"decompress-response": "^4.2.0",
"once": "^1.3.1",

@@ -25,3 +25,3 @@ "simple-concat": "^1.0.0"

"standard": "*",
"string-to-stream": "^1.0.0",
"string-to-stream": "^3.0.0",
"tape": "^4.0.0"

@@ -28,0 +28,0 @@ },

@@ -244,2 +244,15 @@ # simple-get [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![downloads][downloads-image]][downloads-url] [![javascript style guide][standard-image]][standard-url]

### Specifically disallowing redirects
```js
const get = require('simple-get')
const opts = {
url: 'http://example.com/will-redirect-elsewhere',
followRedirects: false
}
// res.statusCode will be 301, no error thrown
get(opts, function (err, res) {})
```
### OAuth

@@ -246,0 +259,0 @@

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