INNER CODE UNIT · TypeScript

httpServer

lazy-dinosaur/ccxt-mcp · src/index.ts:124

  const httpServer = createServer(async (req: IncomingMessage, res: ServerResponse) => {
    try {
      const requestUrl = new URL(req.url || "/", `http://${req.headers.host || "localhost"}`);

      const presentedBearerToken = readBearerTokenFromHeader(req);
      if (!presentedBearerToken) {
        res.writeHead(401, { "content-type": "application/json; charset=utf-8" });
        res.end(
          JSON.stringify({
            jsonrpc: "2.0",
            error: {
              code: -32600,
              message: "Authorization: Bearer <token> required",
            },
            id: null,
          }),
        );
        return;

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…