WIP partial sync requests

This commit is contained in:
zadam
2021-01-10 21:56:40 +01:00
parent cd653b9f0c
commit 7f8b19aee4
6 changed files with 111 additions and 47 deletions

View File

@@ -16,15 +16,25 @@ function exec(opts) {
opts.proxy = null;
}
if (!opts.paging) {
opts.paging = {
pageCount: 1,
pageIndex: 0
};
}
const proxyAgent = getProxyAgent(opts);
const parsedTargetUrl = url.parse(opts.url);
return new Promise((resolve, reject) => {
try {
const headers = {
const headers = Object.assign({
Cookie: (opts.cookieJar && opts.cookieJar.header) || "",
'Content-Type': 'application/json'
};
'Content-Type': opts.paging.pageCount === 1 ? 'application/json' : 'text/plain',
pageCount: opts.pageCount,
pageIndex: opts.pageIndex,
requestId: opts.requestId
}, opts.headers || {});
if (opts.auth) {
const token = Buffer.from(opts.auth.user + ":" + opts.auth.pass).toString('base64');