Skip to content

Commit

Permalink
Migrate from got to node-fetch.
Browse files Browse the repository at this point in the history
  • Loading branch information
rwjblue committed Aug 2, 2020
1 parent cfb5394 commit f488d4e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 122 deletions.
145 changes: 27 additions & 118 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"test": "qunit tests/**/*-test.js"
},
"dependencies": {
"got": "^11.5.1"
"node-fetch": "^2.6.0"
},
"devDependencies": {
"eslint": "^7.6.0",
Expand Down
7 changes: 4 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
'use strict';
const got = require('got');
const fetch = require('node-fetch');

module.exports = async function (channelType) {
let HOST = process.env.EMBER_SOURCE_CHANNEL_URL_HOST || 'https://s3.amazonaws.com';
let PATH = 'builds.emberjs.com';

const result = await got(`${HOST}/${PATH}/${channelType}.json`, { json: true });
const response = await fetch(`${HOST}/${PATH}/${channelType}.json`);
const result = await response.json();

return `${HOST}/${PATH}${result.body.assetPath}`;
return `${HOST}/${PATH}${result.assetPath}`;
};

0 comments on commit f488d4e

Please sign in to comment.