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

@bonniernews/httptest

Package Overview
Dependencies
Maintainers
9
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bonniernews/httptest - npm Package Compare versions

Comparing version 0.0.2 to 1.0.0

CHANGELOG.md

25

index.js

@@ -97,4 +97,17 @@ "use strict";

case "string":
this._asserts.push({ fn: assertHeader, args });
if (args.length === 1) {
this._asserts.push({ fn: assertBody, args });
} else {
this._asserts.push({ fn: assertHeader, args });
}
break;
case "object":
this._asserts.push({ fn: assertBody, args });
break;
default: {
if (args.length === 1) {
this._asserts.push({ fn: assertBody, args });
}
break;
}
}

@@ -131,2 +144,12 @@ return this;

function assertBody(res, expected) {
if (expected instanceof RegExp) {
return assert.match(res.text, expected, "unexpected body");
} else if (expected !== null && typeof expected === "object") {
return assert.deepStrictEqual(res.body, expected, "unexpected body");
}
assert.equal(res.text, expected, "unexpected body");
}
function HttpTest(initiator, options) {

@@ -133,0 +156,0 @@ if (!(this instanceof HttpTest)) return new HttpTest(initiator, options);

2

package.json
{
"name": "@bonniernews/httptest",
"version": "0.0.2",
"version": "1.0.0",
"description": "",

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

@@ -37,3 +37,3 @@ HTTP Test

- `redirects(maxRedirects)`: set number of max redirects, defaults to 0
- `expect(arg[, arg])`: expect statusCode or header with value
- `expect(arg[, arg])`: expect statusCode, header with value, and body

@@ -60,4 +60,6 @@ ## `HttpTest.agent(origin, options)`

.post("/", {})
.json()
.expect(200)
.expect("content-type", "application/json; charset=utf-8");
.expect("content-type", "application/json; charset=utf-8")
.expect({ foo: "bar" });
});

@@ -64,0 +66,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