Socket
Socket
Sign inDemoInstall

sync-request

Package Overview
Dependencies
Maintainers
1
Versions
17
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sync-request - npm Package Compare versions

Comparing version 4.0.2 to 4.0.3

4

index.js

@@ -55,3 +55,3 @@ 'use strict';

while (response !== 'pong') {
const result = spawnSync('nc', ['127.0.0.1', ncPort], {input: 'ping'});
const result = spawnSync('nc', ['127.0.0.1', ncPort], {input: 'ping\r\n'});
response = result.stdout && result.stdout.toString();

@@ -76,3 +76,3 @@ }

});
var res = spawnSync(command, args, {input: req});
var res = spawnSync(command, args, {input: req + '\r\n'});
if (res.status !== 0) {

@@ -79,0 +79,0 @@ throw new Error(res.stderr.toString());

'use strict';
const net = require('net');
const concat = require('concat-stream');
const request = require('then-request');

@@ -13,4 +12,10 @@ const JSON = require('./json-buffer');

c.pipe(concat(function (stdin) {
const str = stdin.toString('utf8');
let buffer = '';
c.on('data', function (data) {
buffer += data.toString('utf8');
if (/\r\n/.test(buffer)) {
onMessage(buffer.trim());
}
});
function onMessage(str) {
if (str === 'ping') {

@@ -21,3 +26,3 @@ c.end('pong');

try {
const req = JSON.parse(stdin.toString());
const req = JSON.parse(str);
request(req.method, req.url, req.options).done(function (response) {

@@ -31,5 +36,5 @@ respond({success: true, response: response});

}
}));
}
});
server.listen(+process.argv[2]);
{
"name": "sync-request",
"version": "4.0.2",
"version": "4.0.3",
"description": "Make synchronous web requests",

@@ -17,6 +17,6 @@ "browser": "./browser.js",

"command-exists": "^1.2.2",
"concat-stream": "^1.4.7",
"get-port": "^2.1.0",
"http-response-object": "^1.0.1",
"then-request": "^2.0.1"
"concat-stream": "^1.6.0",
"get-port": "^3.1.0",
"http-response-object": "^1.1.0",
"then-request": "^2.2.0"
},

@@ -23,0 +23,0 @@ "devDependencies": {

@@ -17,7 +17,7 @@ var request = require('../');

console.dir('https://apache.org');
console.dir('https://expired.badssl.com');
var errored = false;
try {
// Test unauthorized HTTPS GET request
var res = request('GET', 'https://apache.org');
var res = request('GET', 'https://expired.badssl.com');
console.log(res);

@@ -27,3 +27,3 @@ console.log("Reponse Body: ", res.body.toString());

} catch(ex) {
console.log("Successully rejected unauthorized host: https://apache.org/");
console.log("Successully rejected unauthorized host: https://expired.badssl.com");
}

@@ -30,0 +30,0 @@ if (errored) {

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