Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions app/app.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const fs = require('fs');
const path = require('path');
const axios = require('axios');
const debug = require('debug')('pmpact:app');

const isUrl = (value) => /^(?:\w+:)?\/\/(\S+)$/.test(value);
Expand All @@ -15,7 +14,14 @@ const getContent = async (source, headers) => {
if (headers) {
options.headers = JSON.parse(headers);
}
return (await axios.get(source, options)).data;
const response = await fetch(source, options);
Comment thread
juliomalves marked this conversation as resolved.
if (!response.ok) {
const responseBody = await response.text();
const bodyMessage = responseBody ? ` - ${responseBody}` : '';
throw new Error(`Request failed with status ${response.status} ${response.statusText}${bodyMessage}`);

}
return await response.json();
}
else {
debug(`Require file: ${source}`);
Expand Down
266 changes: 3 additions & 263 deletions package-lock.json

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

6 changes: 2 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pmpact",
"version": "0.4.14",
"version": "0.5.0",
"description": "A command line tool to convert Pact files to Postman collections.",
"main": "index.js",
"scripts": {
Expand Down Expand Up @@ -30,11 +30,9 @@
},
"homepage": "https://github.com/ITV/pmpact#readme",
"dependencies": {
"axios": "1.15.0",
"commander": "4.1.1",
"debug": "4.3.4",
"http-status": "1.6.2",
"lodash": "4.18.1"
"http-status": "1.6.2"
},
"devDependencies": {
"execa": "5.1.1",
Expand Down
Loading
Loading