New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

in-process-request

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

in-process-request - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

28

dist/compile/httpMock.js

@@ -30,8 +30,18 @@ "use strict";

const addChunk = (chunk, encoding) => chunks.push(toBuffer(chunk, encoding));
res.write = (chunk) => {
addChunk(chunk);
res.write = (chunk, encodingOrCallback, maybeCallback) => {
const encoding = typeof encodingOrCallback === 'string' ? encodingOrCallback : undefined;
const callback = typeof maybeCallback === 'function' ? maybeCallback : encodingOrCallback;
addChunk(chunk, encoding);
if (typeof callback === 'function') {
callback();
}
return true;
};
const overriddenEnd = (chunk, encoding) => {
const overriddenEnd = (chunk, encodingOrCallback, maybeCallback) => {
const encoding = typeof encodingOrCallback === 'string' ? encodingOrCallback : undefined;
const callback = typeof maybeCallback === 'function' ? maybeCallback : encodingOrCallback;
addChunk(chunk, encoding);
if (typeof callback === 'function') {
callback();
}
const body = Buffer.concat(chunks);

@@ -53,3 +63,8 @@ const headers = getHeaders_1.default(res);

exports.createMockRequest = (opts) => {
const req = new http_1.IncomingMessage(undefined);
const socket = {
remoteAddress: opts.remoteAddress || '123.123.123.123',
remotePort: opts.remotePort || 5757,
encrypted: opts.ssl ? true : false,
};
const req = new http_1.IncomingMessage(socket);
const body = toBuffer(opts.body);

@@ -60,7 +75,2 @@ const contentLength = Buffer.byteLength(body);

req.headers = keysToLowerCase(opts.headers || {});
req.connection = {
remoteAddress: opts.remoteAddress || '123.123.123.123',
remotePort: opts.remotePort || 5757,
encrypted: opts.ssl ? true : false,
};
if (contentLength > 0 && !req.headers['content-length']) {

@@ -67,0 +77,0 @@ req.headers['content-length'] = contentLength.toString();

{
"name": "in-process-request",
"version": "0.0.2",
"version": "0.0.3",
"license": "(MIT OR Apache-2.0)",

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

@@ -11,2 +11,3 @@ # in-process-request

* Connect v3
* Koa v2
* More to come...

@@ -13,0 +14,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