fix: use fetchAgent for uploading data

This commit is contained in:
Adhiraj Singh
2021-12-18 16:44:43 +05:30
parent e393f0f9a8
commit 9e33c80add

View File

@@ -461,7 +461,7 @@ export function extensionForMediaMessage(message: WAMessageContent) {
return extension return extension
} }
export const getWAUploadToServer = ({ customUploadHosts, agent, logger }: CommonSocketConfig<any>, refreshMediaConn: (force: boolean) => Promise<MediaConnInfo>): WAMediaUploadFunction => { export const getWAUploadToServer = ({ customUploadHosts, fetchAgent, logger }: CommonSocketConfig<any>, refreshMediaConn: (force: boolean) => Promise<MediaConnInfo>): WAMediaUploadFunction => {
return async(stream, { mediaType, fileEncSha256B64, timeoutMs }) => { return async(stream, { mediaType, fileEncSha256B64, timeoutMs }) => {
const { default: got } = await import('got') const { default: got } = await import('got')
// send a query JSON to obtain the url & auth token to upload our media // send a query JSON to obtain the url & auth token to upload our media
@@ -482,7 +482,7 @@ export const getWAUploadToServer = ({ customUploadHosts, agent, logger }: Common
'Origin': DEFAULT_ORIGIN 'Origin': DEFAULT_ORIGIN
}, },
agent: { agent: {
https: agent https: fetchAgent
}, },
body: stream, body: stream,
timeout: timeoutMs timeout: timeoutMs