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

response-objects

Package Overview
Dependencies
Maintainers
1
Versions
33
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

response-objects - npm Package Compare versions

Comparing version 0.3.3 to 0.4.0

2

index.js

@@ -62,5 +62,5 @@ const status = require("statuses");

resp.status = resp.statusCode = code;
if (body != null) resp.body = body;
resp.body = body != null ? body : status[code];
if (headers != null) resp.headers = headers;
return resp;
}
{
"name": "response-objects",
"version": "0.3.3",
"version": "0.4.0",
"description": "",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -60,2 +60,11 @@ const expect = require("expect");

it("defaults to status text on null/undefined body", function () {
expect(Ctor().body).toBe(status[statusCode]);
expect(Ctor(null).body).toBe(status[statusCode]);
// other falsy values are ok
expect(Ctor(0).body).toBe(0);
expect(Ctor("").body).toBe("");
});
it("throws if body argument is already a response", function () {

@@ -90,3 +99,3 @@ expect(() => Ctor(someResponse)).toThrow(/Object is already a response/);

// 4.8s with `new` constructors + failed `this instanceof` checks
describe("create 1e7 instances", function () {
xdescribe("create 1e7 instances", function () {
it("is fast enough", function () {

@@ -93,0 +102,0 @@ const body = {}, headers = {};

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