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

Function createOrganization

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

Source from the content-addressed store, hash-verified

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

Calls 4

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

Tested by

no test coverage detected