Skip to content

Commit

Permalink
fix: HTML should be a string (#201)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats authored Mar 14, 2024
1 parent c1d89ad commit f62cbb2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ const fetch = PCancelable.fn(

return contentType.startsWith('text/html') || !isMediaUrl(url)
? await toEncode(res.body, res.headers['content-type'])
: res.body
: res.body.toString()
})()

return {
Expand Down
7 changes: 7 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,13 @@ test('from image URL', async t => {
t.snapshot(prettyHtml($.html()))
})

test('from SVG image URL', async t => {
const targetUrl = 'https://cdn.microlink.io/file-examples/sample.svg'
const { stats } = await getHTML(targetUrl, { getBrowserless })
t.true(stats.timing < 3000)
t.is(stats.mode, 'fetch')
})

test('from big image URL', async t => {
const targetUrl =
'https://static.jutarnji.hr/images/live-multimedia/binary/2016/6/17/10/iStock_82744687_XXLARGE.jpg'
Expand Down

0 comments on commit f62cbb2

Please sign in to comment.