Socket
Socket
Sign inDemoInstall

har-express

Package Overview
Dependencies
63
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.0.1 to 1.0.2

17

index.js
const fs = require('fs');
const url = require('url');
const pathLib = require('path');

@@ -45,11 +46,11 @@ const DEFAULT_OPTIONS = {

if (isDir(path)) {
fs.readdirSync(path).sort().reduce((acc, folderContent) => {
if (isDir(folderContent)) {
acc = mergeHAR(acc, parse(folderContent));
}
if (folder.endsWith('.har')) {
HAR = fs.readdirSync(path).sort().reduce((acc, folderContent) => {
const subpath = pathLib.join(path, folderContent);
if (isDir(subpath)) {
acc = mergeHAR(acc, parse(subpath));
} else if (subpath.endsWith('.har')) {
try {
acc = mergeHAR(acc, JSON.parse(fs.readFileSync(folderContent)));
acc = mergeHAR(acc, JSON.parse(fs.readFileSync(subpath)));
} catch(e) {
console.error(`can't parse the file ${folderContent}`, e);
console.error(`can't parse the file ${subpath}`, e);
}

@@ -93,3 +94,3 @@ }

let results = entries;
// first lets filter on query params
// first lets filter on query params
const withSameQueryString = entries.filter(e => {

@@ -96,0 +97,0 @@ return e.request.queryString.every(qs => req.param(qs.name) === qs.value);

{
"name": "har-express",
"version": "1.0.1",
"version": "1.0.2",
"description": "Use HAR file to create a mock server",

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc