Skip to content
This repository has been archived by the owner on Dec 3, 2021. It is now read-only.

Commit

Permalink
feat: implement postman collection converter (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk authored Jul 1, 2020
1 parent 2fc61ce commit 28a9845
Show file tree
Hide file tree
Showing 21 changed files with 1,109 additions and 9 deletions.
39 changes: 38 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,40 @@
# @neuralegion/postman2har

Service lib description
Transform you Postman collection to a series of HAR request objects.

- https://schema.getpostman.com/collection/json/v2.1.0/draft-07/docs/index.html
- http://www.softwareishard.com/blog/har-12-spec/#request

## Setup

```bash
npm i --save @neuralegion/postman2har
```

## 🚀 Usage

Using as a ES module:

```js
import { postman2har } from '@neuralegion/postman2har';
import collection from 'your-postman-collection.json';

postman2har(collection).then((requests) => {
console.log(requests);
});
```

If you want to pass additional data to resolve environment variables you can pass them via options:
```js
postman2har(collection, {
environment: { baseUrl: 'https://example.com' }
}).then((requests) => {
console.log(requests);
});
```

## 📝License

Copyright © 2020 [NeuraLegion](https://github.com/NeuraLegion).

This project is licensed under the MIT License - see the [LICENSE file](LICENSE) for details.
71 changes: 67 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@
},
"homepage": "https://github.com/NeuraLegion/postman2har#readme",
"dependencies": {
"faker": "^4.1.0",
"semver": "^7.3.2",
"tslib": "~1.11.1"
},
"devDependencies": {
Expand All @@ -56,8 +58,11 @@
"@types/chai": "^4.2.11",
"@types/chai-as-promised": "^7.1.2",
"@types/debug": "^4.1.5",
"@types/faker": "^4.1.12",
"@types/har-format": "^1.2.4",
"@types/mocha": "~7.0.2",
"@types/node": "~14.0.13",
"@types/semver": "^7.3.1",
"@typescript-eslint/eslint-plugin": "^3.3.0",
"@typescript-eslint/parser": "^3.3.0",
"chai": "~4.2.0",
Expand Down
Empty file removed src/.gitkeep
Empty file.
5 changes: 5 additions & 0 deletions src/converter/Converter.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import HarV1 from 'har-format';

export interface Converter {
convert(collection: Postman.Collection): Promise<HarV1.Request[]>;
}
Loading

0 comments on commit 28a9845

Please sign in to comment.