BlueGit

ict rusty-teams

Files

rusty-teams / crates / chatsvc / assets / csa_skype_fetch.js

csa_skype_fetch.js

csa_skype_fetch.js 621 B Download Raw
1const headers = {...args.headers, Authorization: 'Bearer ' + token, 'x-skypetoken': skypeCache.token};
2if (skypeCache.chatService) headers['x-csendpoint'] = skypeCache.chatService;
3try {
4 const response = await fetch(args.url, {
5 method: args.method,
6 headers,
7 body: args.body === null ? undefined : JSON.stringify(args.body),
8 });
9 const text = await response.text();
10 let body = text;
11 try { body = text ? JSON.parse(text) : null; } catch (error) {}
12 return {status: response.status, retryAfter: response.headers.get('Retry-After'), body};
13} catch (error) {
14 return {status: 0, body: String(error)};
15}