MCPcopy
hub / github.com/codeaashu/claude-code / checkEndpoint

Function checkEndpoint

src/utils/preflightChecks.tsx:22–48  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

20 const tokenUrl = new URL(oauthConfig.TOKEN_URL);
21 const endpoints = [`${oauthConfig.BASE_API_URL}/api/hello`, `${tokenUrl.origin}/v1/oauth/hello`];
22 const checkEndpoint = async (url: string): Promise<PreflightCheckResult> => {
23 try {
24 const response = await axios.get(url, {
25 headers: {
26 'User-Agent': getUserAgent()
27 }
28 });
29 if (response.status !== 200) {
30 const hostname = new URL(url).hostname;
31 return {
32 success: false,
33 error: `Failed to connect to ${hostname}: Status ${response.status}`
34 };
35 }
36 return {
37 success: true
38 };
39 } catch (error) {
40 const hostname = new URL(url).hostname;
41 const sslHint = getSSLErrorHint(error);
42 return {
43 success: false,
44 error: `Failed to connect to ${hostname}: ${error instanceof Error ? (error as ErrnoException).code || error.message : String(error)}`,
45 sslHint: sslHint ?? undefined
46 };
47 }
48 };
49 const results = await Promise.all(endpoints.map(checkEndpoint));
50 const failedResult = results.find(result => !result.success);
51 if (failedResult) {

Callers

nothing calls this directly

Calls 3

getUserAgentFunction · 0.85
getSSLErrorHintFunction · 0.85
getMethod · 0.65

Tested by

no test coverage detected