Skip to content

Commit

Permalink
Revert update of 'got'
Browse files Browse the repository at this point in the history
  • Loading branch information
remusao committed Jan 17, 2020
1 parent e5c0e7a commit 829bda9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion packages/goto/package.json
Expand Up @@ -31,7 +31,7 @@
"@browserless/devices": "^5.18.5",
"@cliqz/adblocker-puppeteer": "~1.5.0",
"debug-logfmt": "~1.0.4",
"got": "~10.2.2",
"got": "~9.6.0",
"p-reflect": "~2.1.0",
"p-timeout": "~3.2.0",
"tldts": "~5.6.3"
Expand Down
11 changes: 8 additions & 3 deletions packages/goto/scripts/postinstall.js
Expand Up @@ -9,12 +9,17 @@ const writeFile = promisify(fs.writeFile)

const OUTPUT_FILENAME = 'src/engine.bin'

// Small helpers to allow fetching different types of data with `got`
const fetchBuffer = async url => (await got(url, { encoding: null })).body
const fetchText = async url => Buffer.from(await fetchBuffer(url), 'ascii')
const fetchJson = async url => JSON.parse(await fetchText(url))

// Lightweight `fetch` polyfill on top of `got` to allow consumption by adblocker
const fetch = url =>
Promise.resolve({
text: got(url).text,
arrayBuffer: got(url).buffer,
json: got(url).json
text: () => fetchText(url),
arrayBuffer: () => fetchBuffer(url),
json: () => fetchJson(url)
})

const main = async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/screenshot/package.json
Expand Up @@ -28,7 +28,7 @@
],
"dependencies": {
"@browserless/goto": "^5.19.9",
"got": "~10.2.2",
"got": "~9.6.0",
"is-url-http": "~1.2.4",
"p-reflect": "~2.1.0",
"sharp": "~0.23.4",
Expand Down

0 comments on commit 829bda9

Please sign in to comment.