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

http-enhanced

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

http-enhanced - npm Package Compare versions

Comparing version 0.4.0 to 0.4.1

50

index.js

@@ -111,7 +111,8 @@ /*jslint node: true */ /*globals setImmediate */

};
http.ServerResponse.prototype.writeAll = function(http_code, content_type, body) {
this.writeHead(http_code, {'Content-Type': content_type});
this.writeEnd(body);
http.ServerResponse.prototype.writeAll = function(http_status_code, content_type, body) {
this.writeHead(http_status_code, {'Content-Type': content_type});
this.write(body);
this.end();
};
http.ServerResponse.prototype.json = function(obj) {
http.ServerResponse.prototype.json = function(http_status_code, obj) {
var json;

@@ -126,27 +127,44 @@ try {

};
http.ServerResponse.prototype.html = function(str) {
http.ServerResponse.prototype.html = function(http_status_code, str) {
if (str === undefined) {
str = http_status_code;
http_status_code = 200;
}
this.writeAll(200, 'text/html', str);
};
http.ServerResponse.prototype.text = function(str) {
http.ServerResponse.prototype.text = function(http_status_code, str) {
if (str === undefined) {
str = http_status_code;
http_status_code = 200;
}
this.writeAll(200, 'text/plain', str);
};
http.ServerResponse.prototype.die = function(http_code, err) {
http.ServerResponse.prototype.empty = function(http_status_code) {
// response.writeHead(statusCode, [reasonPhrase], [headers])
if (http_status_code === undefined) {
http_status_code = 200;
}
this.writeHead(http_status_code);
this.end();
};
http.ServerResponse.prototype.die = function(http_status_code, err) {
// if only one argument is specified, it must be the error string
if (err === undefined) {
err = http_code;
http_code = 500;
err = http_status_code;
http_status_code = 500;
}
var str = err ? 'Failure: ' + err.toString() : 'Failure';
this.writeAll(http_code, 'text/plain', str);
var body = err ? 'Failure: ' + err.toString() : 'Failure';
this.writeAll(http_status_code, 'text/plain', body);
};
http.ServerResponse.prototype.redirect = function(http_code, location) {
http.ServerResponse.prototype.redirect = function(http_status_code, location) {
// if only one argument is specified, it must be the location
if (location === undefined) {
location = http_code;
http_code = 302;
location = http_status_code;
http_status_code = 302;
}
this.writeHead(http_code, {'Location': location});
this.writeEnd('Redirecting to: ' + location);
this.writeHead(http_status_code, {'Location': location});
this.write('Redirecting to: ' + location);
this.end();
};
module.exports = http;
{
"name": "http-enhanced",
"version": "0.4.0",
"version": "0.4.1",
"main": "index.js",

@@ -5,0 +5,0 @@ "description": "Drop-in replacement for Node.js standard `http` API with various helpers.",

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