Skip to content

Commit

Permalink
feat: update got
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Feb 1, 2020
1 parent b76e253 commit aa9481e
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
12 changes: 8 additions & 4 deletions packages/metascraper-clearbit/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const got = require('got')
const ENDPOINT = 'https://autocomplete.clearbit.com/v1/companies/suggest'

const DEFAULT_GOT_OPTS = {
json: true,
responseType: 'json',
timeout: 3000,
retry: 0
}
Expand All @@ -26,12 +26,16 @@ const createClearbit = ({ gotOpts, logoOpts } = {}) =>
const domain = getDomain(url)

try {
const { body } = await got(`${ENDPOINT}?query=${domain}`, {
const { body } = await got(ENDPOINT, {
...DEFAULT_GOT_OPTS,
...gotOpts
...gotOpts,
searchParams: { query: domain }
})

return appendQuery(body.find(item => domain === item.domain), logoOpts)
return appendQuery(
body.find(item => domain === item.domain),
logoOpts
)
} catch (err) {
return null
}
Expand Down
2 changes: 1 addition & 1 deletion packages/metascraper-clearbit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
],
"dependencies": {
"@metascraper/helpers": "^5.10.7",
"got": "~9.6.0",
"got": "~10.4.0",
"lodash": "~4.17.15",
"tldts": "~5.6.3"
},
Expand Down

0 comments on commit aa9481e

Please sign in to comment.