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

Function createOrganization

e2e/cloud/oauth-callback-org-scope.test.ts:117–135  ·  view source on GitHub ↗
(baseUrl: string, cookie: string, name: string)

Source from the content-addressed store, hash-verified

115 });
116
117const createOrganization = (baseUrl: string, cookie: string, name: string) =>
118 Effect.promise(async () => {
119 const response = await fetch(new URL("/api/auth/create-organization", baseUrl), {
120 method: "POST",
121 headers: {
122 "content-type": "application/json",
123 cookie,
124 ...originHeaders(baseUrl),
125 },
126 body: JSON.stringify({ name }),
127 });
128 if (!response.ok) {
129 throw new Error(`/api/auth/create-organization failed (${response.status})`);
130 }
131 const session = cookiePair(response, "wos-session");
132 if (!session) throw new Error("create organization did not refresh the session");
133 const org = (await response.json()) as { id: string; name: string; slug: string };
134 return { org, session };
135 });
136
137const oauthIntegrationSpec = (oauth: {
138 readonly authorizationEndpoint: string;

Calls 4

originHeadersFunction · 0.70
cookiePairFunction · 0.70
jsonMethod · 0.65
fetchFunction · 0.50

Tested by

no test coverage detected