From 09ff261f156a8599d45c1496fe246ded6e035191 Mon Sep 17 00:00:00 2001 From: HampusM Date: Mon, 26 Jul 2021 23:56:53 +0200 Subject: Added backend TSDoc/JSDoc comments & refactored a tiny bit --- packages/server/src/git/http.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'packages/server/src/git/http.ts') diff --git a/packages/server/src/git/http.ts b/packages/server/src/git/http.ts index 36bae04..c2654e7 100644 --- a/packages/server/src/git/http.ts +++ b/packages/server/src/git/http.ts @@ -8,12 +8,25 @@ export interface Request extends FastifyRequest { params: Route["Params"], } +/** + * Write the first part of a reference discovery reply + * + * @param service - The git service to write as + * @param reply - A Fastify reply + */ function writeRefDiscoveryFirstLine(service: string, reply: FastifyReply) { const s = "# service=" + service + "\n"; const n = (4 + s.length).toString(16); reply.raw.write(Buffer.from((Array(4 - n.length + 1).join("0") + n + s) + "0000")); } +/** + * Connect to the Git HTTP backend + * + * @param repository - The repository to use + * @param req - A Fastify request + * @param reply - A Fastify reply + */ export function connect(repository: Repository, req: Request, reply: FastifyReply): void { const parsed_url = new URL(`${req.protocol}://${req.hostname}${req.url.replace(req.params.repo, repository.name.short)}`); -- cgit v1.2.3-18-g5258