mirror of
https://github.com/FranP-code/Baileys.git
synced 2025-10-13 00:32:22 +00:00
Added fetch agent
This commit is contained in:
@@ -202,9 +202,15 @@ WAConnectionTest('Messages', conn => {
|
||||
for (let i = 0; i < messages.length;i++) {
|
||||
assert.deepEqual (messages[i].key, msgs[i].key, `failed equal at ${i}`)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
cursor = msgs[0].key
|
||||
|
||||
msgs = await conn.fetchMessagesFromWA (testJid, 20, cursor)
|
||||
messages = (await conn.loadMessages (testJid, 20, cursor)).messages
|
||||
for (let i = 0; i < messages.length;i++) {
|
||||
assert.deepEqual (messages[i].key, msgs[i].key, `failed equal at ${i}`)
|
||||
}
|
||||
}
|
||||
})
|
||||
it('should deliver a message', async () => {
|
||||
const waitForUpdate =
|
||||
|
||||
@@ -377,7 +377,7 @@ export class WAConnection extends EventEmitter {
|
||||
method,
|
||||
body,
|
||||
headers: { Origin: DEFAULT_ORIGIN, ...(headers || {}) },
|
||||
agent: agent || this.connectOptions.agent
|
||||
agent: agent || this.connectOptions.fetchAgent
|
||||
})
|
||||
)
|
||||
generateMessageTag (longTag: boolean = false) {
|
||||
|
||||
@@ -84,8 +84,10 @@ export type WAConnectOptions = {
|
||||
/** max time for the phone to respond to a connectivity test */
|
||||
phoneResponseTime?: number
|
||||
connectCooldownMs?: number
|
||||
/** agent which can be used for proxying connections */
|
||||
/** agent used for WS connections */
|
||||
agent?: Agent
|
||||
/** agent used for fetch requests -- uploading/downloading media */
|
||||
fetchAgent?: Agent
|
||||
}
|
||||
/** from: https://stackoverflow.com/questions/3809401/what-is-a-good-regular-expression-to-match-a-url */
|
||||
export const URL_REGEX = /[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)?/gi
|
||||
|
||||
Reference in New Issue
Block a user