MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / readAuthErrorDetail

Function readAuthErrorDetail

console/src/utils/oidcAuth.ts:13–23  ·  view source on GitHub ↗
(
  response: Response,
)

Source from the content-addressed store, hash-verified

11 * 401s. Returns undefined for the generic `"unauthorized"` body so callers can
12 * distinguish a server-supplied detail from a routine 401. */
13export const readAuthErrorDetail = async (
14 response: Response,
15): Promise<string | undefined> => {
16 try {
17 const body = (await response.clone().text()).trim();
18 if (!body || body === "unauthorized") return undefined;
19 return body;
20 } catch {
21 return undefined;
22 }
23};

Callers 1

Calls 2

trimMethod · 0.45
cloneMethod · 0.45

Tested by

no test coverage detected