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

connect-preprocess

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

connect-preprocess - npm Package Compare versions

Comparing version 0.1.1 to 0.1.2

24

index.js

@@ -19,3 +19,3 @@ module.exports = function( options ) {

var ext = content_type ? mime.extension( content_type ) : req.url.match( /(\.\w+)\??.*$/ );
return this.accept.indexOf( ext ) >= 0;
return res.statusCode == 200 && this.accept.indexOf( ext ) >= 0;
}

@@ -49,4 +49,5 @@ });

res.write = function( string , encoding ) {
encoding = encoding || 'utf-8';
if (string !== undefined) {
var body = string instanceof Buffer ? string.toString( encoding ) : string;
var body = (Buffer.isBuffer( string ) ? string.toString( encoding ) : string);
if (res._headers && $preprocessor._accepts( req , res )) {

@@ -63,9 +64,16 @@ res.push( body );

res.end = function( string , encoding ) {
var body = $preprocessor.engine( res.data );
if (res.data !== undefined && !res._header) {
res.setHeader( 'Content-Length' , Buffer.byteLength( body , encoding ));
encoding = encoding || 'utf-8';
if (res.data && $preprocessor._accepts( req , res )) {
var body = $preprocessor.engine( res.data );
if (res.data !== undefined && !res._header) {
res.setHeader( 'Content-Length' , Buffer.byteLength( body , encoding ));
}
res.data = '';
restore();
res.end( body , encoding );
}
res.data = '';
restore();
res.end( body , encoding );
else {
restore();
next();
}
};

@@ -72,0 +80,0 @@

{
"name": "connect-preprocess",
"description": "flexible preprocessor middleware for connect / express.",
"version": "0.1.1",
"version": "0.1.2",
"main": "index.js",

@@ -6,0 +6,0 @@ "homepage": "https://github.com/elnarddogg/connect-preprocess",

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