Add a function to make the cookie monster happy!
This commit is contained in:
parent
0daf4d895f
commit
22f70c86f5
@ -78,7 +78,6 @@ function login(sessionId: string, user: string, pass: string): Promise<any>
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO: logout
|
|
||||||
function loadCookies(config: IConfig)
|
function loadCookies(config: IConfig)
|
||||||
{
|
{
|
||||||
const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
|
const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
|
||||||
@ -89,6 +88,17 @@ function loadCookies(config: IConfig)
|
|||||||
j = request.jar(new cookieStore(cookiePath));
|
j = request.jar(new cookieStore(cookiePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function eatCookies(config: IConfig)
|
||||||
|
{
|
||||||
|
const cookiePath = path.join(config.output || process.cwd(), '.cookies.json');
|
||||||
|
|
||||||
|
if(fs.existsSync(cookiePath))
|
||||||
|
{
|
||||||
|
fs.removeSync(cookiePath);
|
||||||
|
}
|
||||||
|
j = undefined;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Performs a GET request for the resource.
|
* Performs a GET request for the resource.
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user