Skip to content

Commit

Permalink
fix: buffer params (#143)
Browse files Browse the repository at this point in the history
  • Loading branch information
SaarChaffee authored Mar 5, 2024
1 parent bd3b168 commit ae03e15
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,8 @@ class ImageService extends Service {
}

async imgUrlToBase64(image: ImageSource.Result): Promise<string> {
return this.ctx.http.axios(image.url, { method: 'GET', responseType: 'arraybuffer' }).then(resp => {
return `data:${resp.headers['content-type']};base64,${Buffer.from(resp.data, 'binary').toString('base64')}`
return this.ctx.http(image.url, { method: 'GET', responseType: 'arraybuffer' }).then(resp => {
return `data:${resp.headers['content-type']};base64,${Buffer.from(resp.data).toString('base64')}`
}).catch(err => {
if (Quester.Error.is(err)) {
logger.warn(`Request images failed with HTTP status ${err.response?.status}: ${JSON.stringify(err.response?.data)}.`)
Expand Down

0 comments on commit ae03e15

Please sign in to comment.