MCPcopy Create free account
hub / github.com/UsefulSoftwareCo/executor / withRefreshedSession

Function withRefreshedSession

e2e/cloud/support/session.ts:93–103  ·  view source on GitHub ↗
(
  identity: Identity,
  response: Response,
  orgSelector: string,
)

Source from the content-addressed store, hash-verified

91 * scoped to `orgSelector` — carrying the cookie alone would leave every
92 * org-scoped read the identity goes on to make failing closed. */
93export const withRefreshedSession = (
94 identity: Identity,
95 response: Response,
96 orgSelector: string,
97): Identity => {
98 const refreshed = (response.headers.getSetCookie?.() ?? [])
99 .find((header) => header.startsWith("wos-session="))
100 ?.split(";")[0];
101 if (!refreshed) throw new Error("response did not refresh the session cookie");
102 return { ...identity, headers: { cookie: refreshed, [ORG_SELECTOR_HEADER]: orgSelector } };
103};
104
105/** The org selector this identity's requests carry — the same header the web
106 * client derives from the console URL's slug. */

Callers 2

joinOrgFunction · 0.70
createOrgFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected