Fine-grained session control for node-fetch
This commit is contained in:
parent
d6b7685e61
commit
5e1169bec3
1 changed files with 14 additions and 1 deletions
|
@ -128,6 +128,7 @@ type PromiseAjaxOptionsType = {
|
||||||
certificateAuthority?: string;
|
certificateAuthority?: string;
|
||||||
contentType?: string;
|
contentType?: string;
|
||||||
data?: Uint8Array | string;
|
data?: Uint8Array | string;
|
||||||
|
disableSessionResumption?: boolean;
|
||||||
headers?: HeaderListType;
|
headers?: HeaderListType;
|
||||||
host?: string;
|
host?: string;
|
||||||
password?: string;
|
password?: string;
|
||||||
|
@ -240,7 +241,10 @@ async function _promiseAjax(
|
||||||
agents[cacheKey] = {
|
agents[cacheKey] = {
|
||||||
agent: proxyUrl
|
agent: proxyUrl
|
||||||
? new ProxyAgent(proxyUrl)
|
? new ProxyAgent(proxyUrl)
|
||||||
: new Agent({ keepAlive: true }),
|
: new Agent({
|
||||||
|
keepAlive: !options.disableSessionResumption,
|
||||||
|
maxCachedSessions: options.disableSessionResumption ? 0 : undefined,
|
||||||
|
}),
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -567,6 +571,7 @@ type AjaxOptionsType = {
|
||||||
call: keyof typeof URL_CALLS;
|
call: keyof typeof URL_CALLS;
|
||||||
contentType?: string;
|
contentType?: string;
|
||||||
data?: Uint8Array | Buffer | Uint8Array | string;
|
data?: Uint8Array | Buffer | Uint8Array | string;
|
||||||
|
disableSessionResumption?: boolean;
|
||||||
headers?: HeaderListType;
|
headers?: HeaderListType;
|
||||||
host?: string;
|
host?: string;
|
||||||
httpType: HTTPCodeType;
|
httpType: HTTPCodeType;
|
||||||
|
@ -2569,6 +2574,7 @@ export function initialize({
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
responseType: 'bytes',
|
responseType: 'bytes',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
});
|
});
|
||||||
|
|
||||||
return Proto.GroupExternalCredential.decode(response);
|
return Proto.GroupExternalCredential.decode(response);
|
||||||
|
@ -2639,6 +2645,7 @@ export function initialize({
|
||||||
httpType: 'GET',
|
httpType: 'GET',
|
||||||
responseType: 'bytes',
|
responseType: 'bytes',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
});
|
});
|
||||||
const attributes = Proto.AvatarUploadAttributes.decode(response);
|
const attributes = Proto.AvatarUploadAttributes.decode(response);
|
||||||
|
|
||||||
|
@ -2687,6 +2694,7 @@ export function initialize({
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
data,
|
data,
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
httpType: 'PUT',
|
httpType: 'PUT',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -2704,6 +2712,7 @@ export function initialize({
|
||||||
call: 'groups',
|
call: 'groups',
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
httpType: 'GET',
|
httpType: 'GET',
|
||||||
responseType: 'bytes',
|
responseType: 'bytes',
|
||||||
});
|
});
|
||||||
|
@ -2728,6 +2737,7 @@ export function initialize({
|
||||||
call: 'groupsViaLink',
|
call: 'groupsViaLink',
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
httpType: 'GET',
|
httpType: 'GET',
|
||||||
responseType: 'bytes',
|
responseType: 'bytes',
|
||||||
urlParameters: safeInviteLinkPassword
|
urlParameters: safeInviteLinkPassword
|
||||||
|
@ -2759,6 +2769,7 @@ export function initialize({
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
data,
|
data,
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
httpType: 'PATCH',
|
httpType: 'PATCH',
|
||||||
responseType: 'bytes',
|
responseType: 'bytes',
|
||||||
urlParameters: safeInviteLinkPassword
|
urlParameters: safeInviteLinkPassword
|
||||||
|
@ -2795,6 +2806,7 @@ export function initialize({
|
||||||
call: 'groupJoinedAtVersion',
|
call: 'groupJoinedAtVersion',
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
httpType: 'GET',
|
httpType: 'GET',
|
||||||
responseType: 'byteswithdetails',
|
responseType: 'byteswithdetails',
|
||||||
});
|
});
|
||||||
|
@ -2815,6 +2827,7 @@ export function initialize({
|
||||||
call: 'groupLog',
|
call: 'groupLog',
|
||||||
contentType: 'application/x-protobuf',
|
contentType: 'application/x-protobuf',
|
||||||
host: storageUrl,
|
host: storageUrl,
|
||||||
|
disableSessionResumption: true,
|
||||||
httpType: 'GET',
|
httpType: 'GET',
|
||||||
responseType: 'byteswithdetails',
|
responseType: 'byteswithdetails',
|
||||||
urlParameters:
|
urlParameters:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue