You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
723 B
TypeScript
22 lines
723 B
TypeScript
import {startSession} from "../startSession";
|
|
|
|
const huawei = require('../../jslib/public');
|
|
|
|
export async function getSessionHeaders(url:string):Promise<any> {
|
|
if (huawei.publicSession.login === '1') {
|
|
return {
|
|
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8;enc',
|
|
__RequestVerificationToken: `${huawei.publicSession.token2}`,
|
|
Cookie: `${huawei.publicSession.session}`,
|
|
_ResponseSource: 'Broswer',
|
|
};
|
|
} else {
|
|
const sessionData = await startSession(url);
|
|
return {
|
|
'content-type': 'application/x-www-form-urlencoded; charset=UTF-8;enc',
|
|
__RequestVerificationToken: sessionData.TokInfo,
|
|
Cookie: `SessionId=${sessionData.SesInfo}`,
|
|
};
|
|
}
|
|
}
|