WIP: form attachments tests
Co-Authored-By: Claude Fable 5.2 <[email protected]>
This commit is contained in:
co-authored by
Claude Fable 5.2
parent
6003b3d7d7
commit
02b1e96d3d
@@ -91,6 +91,9 @@ function readGraphEnv(): GraphEnv | null {
|
||||
*/
|
||||
const tokenCache = new Map<string, { expiresAt: number; token: string }>()
|
||||
|
||||
/** Forgets cached Graph tokens (after rotating the client secret in a running process; tests). */
|
||||
export const clearGraphTokenCache = (): void => tokenCache.clear()
|
||||
|
||||
async function getAccessToken(env: GraphEnv, fetchImpl: typeof fetch = fetch): Promise<string> {
|
||||
const cacheKey = `${env.tenantId}:${env.clientId}`
|
||||
const cached = tokenCache.get(cacheKey)
|
||||
|
||||
@@ -170,10 +170,11 @@ export async function handleFormSubmit(req: PayloadRequest): Promise<Response> {
|
||||
if (attemptKey) {
|
||||
const running = inflight.get(attemptKey)
|
||||
if (running) {return stop(await running)}
|
||||
const earlier = await findSubmitAttempt(payload, attemptKey)
|
||||
if (earlier) {return stop(earlier)}
|
||||
// Registered before the next await, so a twin request arriving now waits for this one.
|
||||
registered = attemptKey
|
||||
inflight.set(attemptKey, new Promise<SubmitFormResult>((done) => (settle = done)))
|
||||
const earlier = await findSubmitAttempt(payload, attemptKey)
|
||||
if (earlier) {return stop(earlier)}
|
||||
}
|
||||
|
||||
if (checked.validation.fileFields.length > 0 && !canCarryFiles(checked.validation.form)) {return stop({ reason: 'delivery', success: false })}
|
||||
|
||||
Reference in New Issue
Block a user