new(basic.gblib): HEAR in Teams will get pictures into URL.
This commit is contained in:
parent
ab2851fafe
commit
4368fe447b
2 changed files with 7 additions and 5 deletions
|
@ -952,13 +952,11 @@ export class SystemKeywords {
|
|||
* @example user = get "http://server/users/1"
|
||||
*
|
||||
*/
|
||||
public async getByHttp(url: string, headers: any, username: string, ps: string, qs: any) {
|
||||
public async getByHttp(url: string, headers: any, username: string, ps: string, qs: any, streaming = false) {
|
||||
let options = {
|
||||
|
||||
encoding: "binary",
|
||||
url: url,
|
||||
headers: headers
|
||||
|
||||
};
|
||||
if (username) {
|
||||
options['auth'] = {
|
||||
|
@ -969,13 +967,17 @@ export class SystemKeywords {
|
|||
if (qs) {
|
||||
options['qs'] = qs;
|
||||
}
|
||||
if (streaming) {
|
||||
options['responseType'] = 'stream';
|
||||
options['encoding'] = null;
|
||||
}
|
||||
const isAO = (val) => {
|
||||
return val instanceof Array || val instanceof Object ? true : false;
|
||||
}
|
||||
let result = await request.get(options);
|
||||
|
||||
|
||||
if (isAO(result)) {
|
||||
if (isAO(result) && !streaming) {
|
||||
GBLog.info(`[GET]: ${url} : ${result}`);
|
||||
return JSON.parse(result);
|
||||
}
|
||||
|
|
|
@ -883,7 +883,7 @@ export class GBMinService {
|
|||
const botToken = await credentials.getToken();
|
||||
const headers = { Authorization: `Bearer ${botToken}` };
|
||||
const t = new SystemKeywords(null, null, null);
|
||||
const data = await t.getByHttp(file.contentUrl, headers, null, null, null);
|
||||
const data = await t.getByHttp(file.contentUrl, headers, null, null, null, true);
|
||||
const folder = `work/${min.instance.botId}.gbai/cache`;
|
||||
const filename =`${GBAdminService.generateUuid()}.png`;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue