Socket
Socket
Sign inDemoInstall

teeny-request

Package Overview
Dependencies
Maintainers
4
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

teeny-request - npm Package Compare versions

Comparing version 5.1.3 to 5.2.0

2

build/src/index.d.ts

@@ -61,3 +61,3 @@ /*!

interface Headers {
[index: string]: string | undefined;
[index: string]: any;
}

@@ -64,0 +64,0 @@ declare function teenyRequest(reqOpts: Options): Request;

@@ -42,2 +42,3 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
var http_1 = require("http");
var https_1 = require("https");

@@ -47,4 +48,3 @@ var node_fetch_1 = require("node-fetch");

var uuid = require("uuid");
// tslint:disable-next-line variable-name
var HttpsProxyAgent = require('https-proxy-agent');
var streamEvents = require('stream-events');
var RequestError = /** @class */ (function (_super) {

@@ -89,11 +89,24 @@ __extends(RequestError, _super);

}
var proxy = process.env.HTTP_PROXY ||
var isHttp = uri.startsWith('http://');
var proxy = reqOpts.proxy ||
process.env.HTTP_PROXY ||
process.env.http_proxy ||
process.env.HTTPS_PROXY ||
process.env.https_proxy;
if (reqOpts.proxy || proxy) {
options.agent = new HttpsProxyAgent(proxy);
if (proxy) {
if (isHttp) {
// tslint:disable-next-line variable-name
var HttpProxyAgent = require('http-proxy-agent');
options.agent = new HttpProxyAgent(proxy);
}
else {
// tslint:disable-next-line variable-name
var HttpsProxyAgent = require('https-proxy-agent');
options.agent = new HttpsProxyAgent(proxy);
}
}
else if (reqOpts.forever) {
options.agent = new https_1.Agent({ keepAlive: true });
options.agent = isHttp
? new http_1.Agent({ keepAlive: true })
: new https_1.Agent({ keepAlive: true });
}

@@ -160,3 +173,3 @@ return { uri: uri, options: options };

if (!callback) {
console.log('Error, multipart without callback not implemented.');
console.error('multipart without callback not implemented.');
return;

@@ -195,7 +208,19 @@ }

// Stream mode
var requestStream_1 = new stream_1.PassThrough();
var requestStream_1 = streamEvents(new stream_1.PassThrough());
// tslint:disable-next-line no-any
var responseStream_1;
requestStream_1.once('reading', function () {
if (responseStream_1) {
responseStream_1.pipe(requestStream_1);
}
else {
requestStream_1.once('response', function () {
responseStream_1.pipe(requestStream_1);
});
}
});
options.compress = false;
node_fetch_1.default(uri, options).then(function (res) {
res.body.on('error', function (err) {
console.log('whoa there was an error, passing it on: ' + err);
responseStream_1 = res.body;
responseStream_1.on('error', function (err) {
requestStream_1.emit('error', err);

@@ -206,3 +231,2 @@ });

}, function (err) {
console.log('such a nice error:' + err);
requestStream_1.emit('error', err);

@@ -209,0 +233,0 @@ });

# Changelog
## [5.2.0](https://www.github.com/googleapis/teeny-request/compare/v5.1.3...v5.2.0) (2019-08-13)
### Bug Fixes
* if scheme is http:// use an HTTP agent ([#75](https://www.github.com/googleapis/teeny-request/issues/75)) ([abdf846](https://www.github.com/googleapis/teeny-request/commit/abdf846))
* remove unused logging ([#71](https://www.github.com/googleapis/teeny-request/issues/71)) ([4cb4967](https://www.github.com/googleapis/teeny-request/commit/4cb4967))
* undefined headers breaks compatibility with auth ([#66](https://www.github.com/googleapis/teeny-request/issues/66)) ([12901a0](https://www.github.com/googleapis/teeny-request/commit/12901a0))
### Features
* support lazy-reading from response stream ([#74](https://www.github.com/googleapis/teeny-request/issues/74)) ([f6db420](https://www.github.com/googleapis/teeny-request/commit/f6db420))
* support reading from the request stream ([#67](https://www.github.com/googleapis/teeny-request/issues/67)) ([ae23054](https://www.github.com/googleapis/teeny-request/commit/ae23054))
### Reverts
* do not pipe fetch response into user stream ([#72](https://www.github.com/googleapis/teeny-request/issues/72)) ([6ec812e](https://www.github.com/googleapis/teeny-request/commit/6ec812e))
### [5.1.3](https://www.github.com/googleapis/teeny-request/compare/v5.1.2...v5.1.3) (2019-08-06)

@@ -4,0 +24,0 @@

{
"name": "teeny-request",
"version": "5.1.3",
"version": "5.2.0",
"description": "Like request, but smaller.",

@@ -38,4 +38,6 @@ "main": "./build/src/index.js",

"dependencies": {
"http-proxy-agent": "^2.1.0",
"https-proxy-agent": "^2.2.1",
"node-fetch": "^2.2.0",
"stream-events": "^1.0.5",
"uuid": "^3.3.2"

@@ -42,0 +44,0 @@ },

Sorry, the diff of this file is not supported yet

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