Skip to content

Commit

Permalink
feat: handle http redirects
Browse files Browse the repository at this point in the history
  • Loading branch information
idranme committed Jan 6, 2024
1 parent 6390012 commit eae889d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/axios/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,13 @@ export class Quester {
const name = 'file' + (ext ? '.' + ext : '')
return { mime, filename: name, data: base64ToArrayBuffer(base64) }
}
let [, name] = this.resolve(url).match(/.+\/([^/?]*)(?=\?)?/)!
const { headers, data } = await this.axios(url, {
const { headers, data, request } = await this.axios(url, {
method: 'GET',
responseType: 'arraybuffer',
timeout: +options.timeout! || undefined,
})
const mime = headers['content-type']
let [, name] = this.resolve(request.res.responseUrl).match(/.+\/([^/?]*)(?=\?)?/)!
if (!name.includes('.')) {
const ext = mimedb[mime]?.extensions?.[0]
name += ext ? '.' + ext : ''
Expand Down

0 comments on commit eae889d

Please sign in to comment.