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

@launchdarkly/node-server-sdk

Package Overview
Dependencies
Maintainers
1
Versions
68
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@launchdarkly/node-server-sdk - npm Package Compare versions

Comparing version 9.1.1 to 9.2.0

7

CHANGELOG.md

@@ -11,2 +11,9 @@ # Changelog

## [9.2.0](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v9.1.1...node-server-sdk-v9.2.0) (2024-02-14)
### Features
* Implement handling for gzip compressed responses. ([#367](https://github.com/launchdarkly/js-core/issues/367)) ([a52bee1](https://github.com/launchdarkly/js-core/commit/a52bee19b909b210b4957d46a300777de0e27ada))
## [9.1.1](https://github.com/launchdarkly/js-core/compare/node-server-sdk-v9.1.0...node-server-sdk-v9.1.1) (2024-02-08)

@@ -13,0 +20,0 @@

2

dist/package.json
{
"name": "@launchdarkly/node-server-sdk",
"version": "9.1.1",
"version": "9.2.0",
"description": "LaunchDarkly Server-Side SDK for Node.js",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/server-node",

@@ -78,8 +78,13 @@ "use strict";

fetch(url, options = {}) {
var _a;
const isSecure = url.startsWith('https://');
const impl = isSecure ? https : http;
// For get requests we are going to automatically support compressed responses.
// Note this does not affect SSE as the event source is not using this fetch implementation.
const headers = ((_a = options.method) === null || _a === void 0 ? void 0 : _a.toLowerCase()) === 'get'
? Object.assign(Object.assign({}, options.headers), { 'accept-encoding': 'gzip' }) : options.headers;
return new Promise((resolve, reject) => {
const req = impl.request(url, {
timeout: options.timeout,
headers: options.headers,
headers,
method: options.method,

@@ -86,0 +91,0 @@ agent: this.agent,

/// <reference types="node" />
/// <reference types="node" />
import * as http from 'http';
import { Writable } from 'stream';
import { platform } from '@launchdarkly/js-server-sdk-common';
export default class NodeResponse implements platform.Response {
incomingMessage: http.IncomingMessage;
body: any[];
chunks: any[];
memoryStream: Writable;
promise: Promise<string>;

@@ -8,0 +11,0 @@ headers: platform.Headers;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const stream_1 = require("stream");
const zlib = require("zlib");
const HeaderWrapper_1 = require("./HeaderWrapper");
class NodeResponse {
constructor(res) {
this.body = [];
this.chunks = [];
this.memoryStream = new stream_1.Writable({
decodeStrings: true,
write: (chunk, _enc, next) => {
this.chunks.push(chunk);
next();
},
});
this.listened = false;

@@ -14,14 +23,20 @@ this.headers = new HeaderWrapper_1.default(res.headers);

this.promise = new Promise((resolve, reject) => {
res.on('data', (chunk) => {
this.body.push(chunk);
});
res.on('error', (err) => {
this.rejection = err;
if (this.listened) {
reject(err);
// Called on error or completion of the pipeline.
const pipelineCallback = (err) => {
if (err) {
this.rejection = err;
if (this.listened) {
reject(err);
}
}
});
res.on('end', () => {
resolve(Buffer.concat(this.body).toString());
});
return resolve(Buffer.concat(this.chunks).toString());
};
switch (res.headers['content-encoding']) {
case 'gzip':
(0, stream_1.pipeline)(res, zlib.createGunzip(), this.memoryStream, pipelineCallback);
break;
default:
(0, stream_1.pipeline)(res, this.memoryStream, pipelineCallback);
break;
}
});

@@ -28,0 +43,0 @@ }

{
"name": "@launchdarkly/node-server-sdk",
"version": "9.1.1",
"version": "9.2.0",
"description": "LaunchDarkly Server-Side SDK for Node.js",

@@ -5,0 +5,0 @@ "homepage": "https://github.com/launchdarkly/js-core/tree/main/packages/sdk/server-node",

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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