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

@bonniernews/b0rker

Package Overview
Dependencies
Maintainers
28
Versions
79
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bonniernews/b0rker - npm Package Compare versions

Comparing version 4.4.3 to 4.5.0

5

lib/http.js

@@ -39,2 +39,6 @@ import GoogleAuth from "google-auth-library";

}
if (params.responseType) {
opts.responseType = params.responseType;
}
let response;

@@ -147,2 +151,3 @@ try {

if (!body) return;
if (body.readable) return "streamed";
const s = JSON.stringify(body);

@@ -149,0 +154,0 @@ return s.substring(0, 4000);

2

package.json
{
"name": "@bonniernews/b0rker",
"version": "4.4.3",
"version": "4.5.0",
"engines": {

@@ -5,0 +5,0 @@ "node": ">=16 <=18"

import nock from "nock";
import { fakeGcpAuth } from "@bonniernews/lu-test";
import config from "exp-config";
import { Readable } from "stream";

@@ -56,2 +57,14 @@ import http from "../../lib/http.js";

it("should do stream get-requests", async () => {
const content = "some content\nsome other content\n";
fakeApi.get("/some/path").reply(200, Readable.from([ content ]));
const result = await http.asserted.get({ path: "/some/path", responseType: "stream", correlationId });
result.should.be.instanceOf(Readable);
const chunks = [];
for await (const chunk of result) {
chunks.push(Buffer.from(chunk));
}
Buffer.concat(chunks).toString("utf-8").should.eql(content);
});
it("should fail on 500", (done) => {

@@ -140,2 +153,27 @@ fakeApi.get("/some/path").reply(500, { ok: false });

it("should do stream get-requests", async () => {
const content = "some content\nsome other content\n";
fakeApi.get("/some/path").reply(200, Readable.from([ content ]));
const result = await http.get({ path: "/some/path", responseType: "stream", correlationId });
result.statusCode.should.eql(200);
result.body.should.be.instanceOf(Readable);
const chunks = [];
for await (const chunk of result.body) {
chunks.push(Buffer.from(chunk));
}
Buffer.concat(chunks).toString("utf-8").should.eql(content);
});
it("should do stream post-requests", async () => {
const content = "some content\nsome other content\n";
fakeApi.post("/some/path").reply(200, { ok: true });
const result = await http.post({
path: "/some/path",
body: Readable.from([ content ]),
correlationId,
});
result.statusCode.should.eql(200);
result.body.should.eql({ ok: true });
});
it("should not fail on 500", async () => {

@@ -142,0 +180,0 @@ fakeApi.get("/some/path").reply(500, { ok: false });

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