mirror of
https://github.com/freeCodeCamp/freeCodeCamp.git
synced 2026-05-28 18:26:54 +00:00
feat(api): port /confirm-email to new api (#54975)
Co-authored-by: Niraj Nandish <nirajnandish@icloud.com>
This commit is contained in:
committed by
GitHub
parent
2c611fb15b
commit
22e74e6406
+6
-1
@@ -46,10 +46,11 @@ export function superRequest(
|
||||
config: {
|
||||
method: 'GET' | 'POST' | 'PUT' | 'DELETE';
|
||||
setCookies?: string[];
|
||||
headers?: { referer: string };
|
||||
},
|
||||
options?: Options
|
||||
): request.Test {
|
||||
const { method, setCookies } = config;
|
||||
const { method, setCookies, headers } = config;
|
||||
const { sendCSRFToken = true } = options ?? {};
|
||||
|
||||
const req = requests[method](resource).set('Origin', ORIGIN);
|
||||
@@ -58,6 +59,10 @@ export function superRequest(
|
||||
void req.set('Cookie', getCookies(setCookies));
|
||||
}
|
||||
|
||||
if (headers) {
|
||||
void req.set('Referer', headers.referer);
|
||||
}
|
||||
|
||||
const csrfToken = (setCookies && getCsrfToken(setCookies)) ?? '';
|
||||
if (sendCSRFToken) {
|
||||
void req.set('CSRF-Token', csrfToken);
|
||||
|
||||
Reference in New Issue
Block a user