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

har2postman

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

har2postman - npm Package Compare versions

Comparing version 0.5.0 to 0.6.0

test/0.6.0/input.json

25

lib/har-to-postman.js

@@ -50,2 +50,14 @@ const HarToPostman = () => { };

break;
case 201:
status = 'created';
break;
case 202:
status = 'accepted';
break;
case 204:
status = 'no-content';
break;
case 403:
status = 'forbidden';
break;
}

@@ -115,3 +127,6 @@ let itemName = method + ' ' + path;

relevantHarHeaders.map((relevantHeader) => {
itemRequestHeaders.push(harRequestHeaders.find((header) => header.name === relevantHeader));
const newItemRequestHeader = harRequestHeaders.find((header) => header.name === relevantHeader);
if (newItemRequestHeader != undefined) {
itemRequestHeaders.push(newItemRequestHeader);
}
});

@@ -168,9 +183,13 @@ itemRequestHeaders.forEach((header) => {

const id = getIdFromUrl(harRequestUrl);
return response.content && response.content.text && parseInt(JSON.parse(response.content.text).id) === id;
return responseIsJson(response) && parseInt(JSON.parse(response.content.text).id) === id;
};
const responseIsArray = (response) => {
return response.content && response.content.text && Array.isArray(JSON.parse(response.content.text));
return responseIsJson(response) && Array.isArray(JSON.parse(response.content.text));
};
const responseIsJson = (response) => {
return response.content && response.content.text && response.content.mimeType === 'application/json';
};
const getIdFromUrl = (harRequestUrl) => {

@@ -177,0 +196,0 @@ const harPathnameArray = harRequestUrl.pathname.split('/');

2

package.json
{
"name": "har2postman",
"version": "0.5.0",
"version": "0.6.0",
"description": "Har to postman converter",

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

@@ -70,3 +70,4 @@ # Har2Postman

### v0.6.0 - Any status code must be supported
* Status code such as 200, 204, 400, 401, 403 or 404 must have specific assertions.
* Status code such as 200, 204, 400, 401, 403 or 404 must have specific assertions.
* Non-json responses should even not tried to be analysed

@@ -76,3 +77,2 @@

### Future features still to be planned
* Status codes other than 200 should be supported, and tests for them should be consistent (not checking id is correct for a 400 code)
* Requests could include some way of authorization

@@ -79,0 +79,0 @@ * Requests might include more useful headers

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