vjudge: fix set-cookie

This commit is contained in:
undefined committed 2021-06-21 14:26:45 +08:00
1 parent 0a11be95da
commit 10603d9602
2 files changed
+6 -2

No files matched your search

+5 -1
View File
@@ -56,7 +56,11 @@ export default class CodeforcesProvider implements IBasicProvider {
}
async getCsrfToken(url: string) {
const { text: html } = await this.get(url);
const { text: html, header } = await this.get(url);
if (header['set-cookie']) {
await this.save({ cookie: header['set-cookie'] });
this.cookie = header['set-cookie'];
}
const $dom = new JSDOM(html);
return $dom.window.document.querySelector('meta[name="X-Csrf-Token"]').getAttribute('content');
}